Data processing apparatus and method for moving data between registers and memory in response to an access instruction having an alignment specifier identifying an alignment to be associated with a start address

ABSTRACT

The present invention provides a data processing apparatus and method for performing aligned access operations. The data processing apparatus comprises a register data store having a plurality of registers operable to store data elements, and a processor operable to perform a data processing operation on one or more data elements accessed in at least one of the registers. Further, access logic is provided which is operable in response to an access instruction to perform an access operation in order to move a number of data elements between specified registers and a portion of a memory, the portion having a start address specified by the access instruction. Further, the access instruction has an alignment specifier associated therewith which is settable either to a first value or one of a plurality of second values. The first value indicates that the start address is to be treated as byte aligned, and each of the second values indicates a different predetermined alignment that the start address is to be treated as conforming to. The access logic is then operable to adapt the access operation in dependence on the value of alignment specifier. This provides significantly improved flexibility in the performance of access operations.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a data processing apparatus and methodfor moving data between registers and memory.

2. Description of the Prior Art

An access instruction used to move data between registers and memorywill have a start address associated therewith identifying a locationwithin the memory from which the access operation used to implement theaccess instruction should begin. The access instruction may be a loadinstruction used to load data from memory into the registers, or a storeinstruction used to store data from the registers to the memory.

Typically, the minimum size of data which can be moved between thememory and registers is one byte of data. Consequently, addresses aretypically specified in units of bytes. It is known to provide an accessinstruction which specifies that the start address is to be treated asbyte aligned, often also referred to as an unaligned access. It is alsoknown to provide an access instruction which specifies that the startaddress has a predetermined natural alignment as specified by theparticular architecture in which the instruction is being used. As anexample, if the architecture specifies that the size of data the subjectof such access instructions is 64-bits in length, then an instructionwhich assumes that the start address is naturally aligned will assumethat the start address for the access is a multiple of 64 bits, i.e.that the least significant three bits of the start address are allzeros.

Whilst the ability to specify an aligned access in the above manner isbeneficial, since an access operation based on a start address which isaligned can typically be performed more quickly than an access operationbased on a start address which is unaligned, the above approach isrelatively inflexible. In particular, the understanding of what is meantby the term “aligned” is fixed at the architectural level for aparticular transfer size. This lack of flexibility is compoundedparticularly in situations where it is desired that the amount of datato be transferred by an access operation can be varied.

Accordingly, it would be desirable to provide a more flexible techniquefor performing aligned access operations.

SUMMARY OF THE INVENTION

Viewed from a first aspect, the present invention provides a dataprocessing apparatus, comprising: a register data store having aplurality of registers operable to store data elements; a processoroperable to perform a data processing operation on one or more dataelements accessed in at least one of said registers; access logicoperable in response to an access instruction to perform an accessoperation in order to move a number of data elements between specifiedregisters and a portion of a memory, the portion having a start addressspecified by the access instruction; the access instruction having analignment specifier associated therewith which is settable either to afirst value or one of a plurality of second values, the first valueindicating that the start address is to be treated as byte aligned, andeach of the second values indicating a different predetermined alignmentthat the start address is to be treated as conforming to; and the accesslogic being operable to adapt the access operation in dependence on thevalue of the alignment specifier.

The data processing apparatus of the present invention has a registerdata store with a plurality of registers operable to store dataelements, and a processor operable to perform a data processingoperation on one or more of those data elements. Further, access logicis operable in response to an access instruction to perform an accessoperation in order to move a number of data elements between specifiedregisters and a portion of memory, the portion having a start addressspecified by the access instruction. This start address may be specifieddirectly by the instruction, or alternatively may be specified in anindirect manner, for example by the access instruction identifying aregister containing data from which the start address can be derived.

In accordance with the present invention, the access instruction has analignment specifier associated therewith which is settable to one of atleast three different values. More particularly, the alignment specifiermay be settable to a first value indicating that the start address is tobe treated as byte aligned, or may be set to one of a plurality ofsecond values each indicating a different predetermined alignment thatthe start address is to be treated as conforming to. As will beappreciated by those skilled in the art, the minimum amount of data thatcan be individually addressed in a memory system is typically a byte ofdata, and accordingly if the start address is indicated as being bytealigned, this is often referred to as an unaligned access. In contrast,the different predetermined alignments that may be specified by each ofthe second values will identify an alignment to a coarser granularitythan a byte, and typically will specify a certain multiple number ofbytes that the start address is to be treated as being aligned with.

In accordance with the present invention, the access logic is thenoperable to adapt the access operation in dependence on the value of thealignment specifier. This provides significantly improved flexibility,since for any particular access instruction, the alignment can beindependently specified to take either the first value or any one of theplurality of second values. Hence, any particular access instruction canbe indicated as relating to a byte aligned access, or alternatively canbe indicated as relating to one of a number of different predeterminedalignments. Accordingly, the alignment is not constrained to be of oneparticular type set by the architecture, and further whilst it is stillpossible to specify a natural alignment, other predetermined alignmentswhich are not a natural alignment can also be specified. For example,when accessing a 64-bit block of data, the access instruction mayspecify that the access should be treated as byte aligned (i.e.unaligned), 64-bit aligned (i.e. natural aligned), or at least one otheralignment (for example 16-bit aligned, 32-bit aligned, 128-bit aligned,256-bit aligned, etc). Hence, for a particular transfer size, there area number of different alignments that can be specified.

This information is very useful to the access logic, since it isavailable before the start address is typically computed, and enablesthe access logic to make certain assumptions about the access before thestart address is computed, which can significantly improve theefficiency of the access operation.

It will be appreciated that there are a number of ways in which theaccess logic can adapt the access operation. However, in one embodiment,the access logic is operable to adapt the access operation bydetermining a number of accesses to be allocated to perform the accessoperation in dependence on the value of the alignment specifier.

For any particular implementation, the bus coupling the access logicwith the memory will be of a predetermined size. Further, the accesslogic will typically have to use that information along with anindication of the size of the block of data to be accessed, in order toallocate an appropriate number of accesses to the access operation.Further, this decision typically needs to be taken at a time before thestart address is actually known. For example, in a pipelinedimplementation, the access logic may need to allocate the number ofaccesses during a decode stage, whilst the start address is not actuallycomputed until a later execute stage of the pipeline. By providing thealignment specifier in association with the access instruction, thisenables the access logic to potentially reduce the number of accessesthat it has to allocate to the access operation if the alignmentspecifier is indicating a certain alignment. As an example, if the blockof data is 128 bits in length, and the data bus between the access logicand the memory is 64 bits wide, then in a worse case scenario the accesslogic has to allocate three accesses to the access operation. Inparticular, if the alignment specifier specifies that the start addressis byte aligned, then the access logic will have to allocate threeaccesses to the access operation. However, if the alignment specifierspecifies that the start address is 64-bit aligned, then instead theaccess logic is able to allocate two accesses to the access operation,thereby yielding a significant performance benefit.

In addition to allowing the access logic to alter the number of accessesallocated to perform the access operation, the alignment specifier mayin addition, or alternatively, be used by the access logic to adapt theaccess operation in other ways. For example, the alignment specifier mayenable the access logic to make certain assumptions about the number ofcache lines that will need to be accessed within a cache of the memorysystem, the number of page tables that may need to be accessed within amemory management unit (MMU) used to manage the access, etc.

It will be appreciated that the alignment specifier can be provided in anumber of ways. In one embodiment, the alignment specifier is providedwithin the access instruction itself. However, in an alternativeembodiment, a status register may be provided which is operable to storethe alignment specifier. The access instruction may then, as an example,identify that status register so that the appropriate alignmentspecifier can then be identified.

The access instruction may take a variety of forms. In one embodiment,the access instruction is a load instruction, said access logic beingoperable in response to said load instruction to load the number of dataelements from said portion of memory to said specified registers.Alternatively, the access instruction may be a store instruction, saidaccess logic being operable in response to said store instruction tostore the number of data elements from said specified registers to saidportion of memory.

In one embodiment of the present invention, the number of data elementsthat may be the subject of the access instruction can vary, and inparticular in one embodiment the number of data elements comprises aplurality of data elements, and the number of data elements is derivablefrom the access instruction. In such situations, the use of the presentinvention is particularly advantageous, since it enables the dataprocessing apparatus to handle accesses of differing sized data chunksin a flexible and efficient manner, by enabling the alignment for eachaccess to be specified on a per instruction basis.

It will be appreciated that the use of an alignment specifier inaccordance with the present invention will be useful in a variety ofsituations. However, in one embodiment, the processor is operable toperform in parallel a data processing operation on multiple dataelements accessed in at least one of said registers. Such processing isoften referred to as Single Instruction Multiple Data (SIMD) processing,and in accordance with the SIMD approach, multiple data elements areplaced side-by-side within a register, and then an operation isperformed in parallel on those data elements. In such implementations,it is often the case that the individual data elements may be singlebytes, as for example is common in video standards. As there are norestrictions on the alignment of array indices in most algorithms, thismeans that the access operations in such implementations have to supportaccesses at any byte alignment. A common example is motion compensation,as used in video codecs. Here, a block of 8×8 8-bit values at any (x,y)position within an image need to be loaded, and by their nature theaccesses required to load this data will be unaligned accesses. However,due the extra implied operations, unaligned accesses may take longer tocomplete than aligned accesses. Accordingly, wherever alignment doesexist, the use of the alignment specifier enables this information to bemade available to the access logic at an early stage, thus allowing theaccess logic to adapt the access operation appropriately in order toseek to improve the efficiency of the access.

Viewed from a second aspect, the present invention provides a method ofoperating a data processing apparatus comprising a register data storehaving a plurality of registers operable to store data elements, and aprocessor operable to perform a data processing operation on one or moredata elements accessed in at least one of said registers, the methodcomprising the steps of: (a) issuing an access instruction used toperform an access operation in order to move a number of data elementsbetween specified registers and a portion of a memory, the portionhaving a start address specified by the access instruction; an alignmentspecifier being associated with the access instruction and being seteither to a first value or one of a plurality of second values, thefirst value indicating that the start address is to be treated as bytealigned, and each of the second values indicating a differentpredetermined alignment that the start address is to be treated asconforming to, and the method further comprising the steps of: (b)adapting the access operation in dependence on the value of thealignment specifier; and (c) performing the access operation.

Viewed from a third aspect, the present invention provides a computerprogram product comprising a computer program including at least oneaccess instruction which when executed causes a data processingapparatus to operate in accordance with the method of the second aspectof the present invention.

DESCRIPTION OF THE DRAWINGS

The present invention will be described further, by way of example only,with reference to preferred embodiments thereof as illustrated in theaccompanying drawings, in which:

FIG. 1 schematically illustrates an integrated circuit supporting bothconventional scalar data processing and SIMD data processing;

FIG. 2 schematically illustrates a read and write port arrangement for aSIMD register data store;

FIG. 3 schematically illustrates an example SIMD read and writeoperation in which the destination register is twice the width of thesource registers;

FIG. 4 shows different types of relationship between source registersize and destination register size for different data processingoperations;

FIG. 5 schematically illustrates a syntax which may be used to define adata processing instruction in accordance with the present techniques;

FIG. 6 schematically illustrates the SIMD register data store viewed as64-bit registers and 128-bit registers;

FIG. 7 schematically illustrates the overlap (“aliasing”) between 64-bitand 128-bit registers;

FIG. 8 schematically illustrates a plurality of data elements storedwithin SIMD registers of different sizes;

FIG. 9 schematically illustrates the referencing of a scalar valuewithin a SIMD vector register;

FIG. 10 schematically illustrates a data processing instruction in whichthe number of processing lanes and the data element size remainconstant;

FIGS. 11A and 11B schematically illustrate a data processing instructionin which the number of processing lanes remains constant and the dataelement size changes;

FIG. 12 illustrates the transfer of data between a SIMD register datastore and a scalar register data store;

FIGS. 13, 14 and 15 schematically illustrate the operation of variousregister transfer instructions;

FIG. 16 is a flow diagram illustrating an example of a situation inwhich register transfer instructions of the types illustrated in FIGS.14 and 15 maybe usefully employed;

FIG. 17 is a diagram schematically illustrating how data elements areloaded from a continuous block of memory into some specified registersin accordance with one embodiment;

FIG. 18 schematically illustrates some examples of different structuresthat may exist within memory in accordance with embodiments;

FIGS. 19A to 19C illustrate the operation of a particular example of asingle store instruction in accordance with one embodiment;

FIGS. 20A to 20C illustrate the operation of a particular example of asingle load instruction in accordance with one embodiment;

FIGS. 21A to 21C illustrate the operation of a further particularexample of a single load instruction in accordance with one embodiment;

FIGS. 22A to 22C illustrate the operation of another particular exampleof a single load instruction in accordance with one embodiment;

FIG. 23 is a block diagram illustrating in more detail the logicprovided within the reordering logic of FIG. 1;

FIGS. 24A–26E illustrate the flow of data through the reordering logicfor four different sequences of single access instructions in accordancewith embodiments;

FIG. 27 illustrates a known folding operation;

FIG. 28 illustrates a folding operation of one embodiment;

FIG. 29 illustrates a folding operation of another embodiment;

FIGS. 30 a to 30 d illustrate the operation of various foldinginstructions;

FIG. 31 illustrates schematically logic arranged to perform a foldingoperation provided within the SIMD processing logic of FIG. 1;

FIG. 32 illustrates the operation of a vector-by-scalar instruction;

FIG. 33 illustrates an arrangement of scalar operands in the SIMDregister file of FIG. 1;

FIG. 34 illustrates schematically logic arranged to perform avector-by-scalar operation provided within the SIMD processing logic ofFIG. 1;

FIG. 35 shows a method of shifting right and packing high according tothe prior art;

FIG. 36 schematically shows a shift right and narrow operation accordingto an embodiment of the present technique;

FIG. 37 schematically shows a shift left and narrow according to thepresent technique;

FIG. 38 schematically shows a cast up and shift left according to anembodiment of the present technique;

FIG. 39 schematically shows a shifting of data elements by differentamounts;

FIG. 40 schematically shows a conventional multiplexer;

FIG. 41 schematically shows an embodiment where the selection of sourcevalues a or b is done on a bit-wise basis;

FIG. 42 schematically shows an alternative embodiment where theselection of source values a or b is done on a data element basis;

FIG. 43 schematically shows three examples of multiplexer arrangementscorresponding to the three multiplexing instructions provided by thepresent technique;

FIG. 44 schematically illustrates a SIMD register storing multiple dataelements in different layouts depending upon the endianess mode;

FIG. 45 schematically illustrates the operation of memory accessinglogic and data element reordering logic in accordance with a firstexample;

FIG. 46 schematically illustrates the operation of memory accessinglogic and data element reordering logic in accordance with a secondexample;

FIG. 47 schematically illustrates an example embodiment of the dataelement reordering logic of FIGS. 45 and 46 in more detail;

FIG. 48 schematically illustrates a register data store including tworegisters serving as table registers, a result register and an indexregister;

FIG. 49 schematically illustrates the action of a table lookup extensioninstruction;

FIG. 50 schematically illustrates processing performed upon an indexregister before the index values within the index register are reused bya further table lookup extension instruction;

FIG. 51 schematically illustrates the operation of a table lookupinstruction in which zero values are written into the result registersat locations corresponding to out-of-range index values;

FIG. 52 illustrates how the LSU of FIG. 1 is coupled with a memorysystem and a Memory Management Unit in accordance with one embodiment;

FIGS. 53A to 53D are diagrams schematically illustrating variousexamples of data blocks to be accessed in accordance with an embodiment;

FIGS. 54A and 54B are diagrams schematically illustrating furtherexamples of data blocks to be accessed in accordance with an embodiment;

FIGS. 55A to 55C schematically illustrate an interleave operation, ade-interleave operation and a transpose operation, respectively;

FIGS. 56A and 56B schematically illustrate how interleave and transposeoperations are performed in accordance with one embodiment;

FIGS. 57A to 57C illustrate how a sequence of instructions in accordancewith one embodiment may be used to transpose an array of image pixels;

FIG. 58 illustrates how an instruction of one embodiment may be used tointerleave real and imaginary parts of complex numbers;

FIGS. 59A and 59B illustrate how a sequence of two instructions inaccordance with one embodiment can be used to perform in parallel amultiplication of two complex numbers;

FIG. 60 schematically shows an add returning high half operation and itsassociated instruction;

FIG. 61 schematically shows an add returning high half operation withrounding and its associated instruction;

FIG. 62 schematically shows a subtract returning high half operation andits associated instruction;

FIG. 63 shows a table of possible constants generated from aninstruction having a data portion, abcdefgh and a control portionassociated with it;

FIG. 64 shows constant generation logic;

FIG. 65 shows a data processor having constant generation logic;

FIGS. 66A and 66B schematically show a data processor response to twotypes of instruction with generated constant; and

FIG. 67 shows the generation of a bit mask according to the presenttechnique.

DESCRIPTION OF EMBODIMENTS

FIG. 1 schematically illustrates a data processing system (integratedcircuit) 2 incorporating both a scalar data processing functionality anda SIMD data processing functionality. The scalar data processing portioncan be considered to be a standard ARM processor core incorporating ascalar register data store 4, a multiplier 6, a shifter 8, an adder 10,an instruction pipeline 12 and a scalar decoder 14 as well as many othercircuit elements which have not, for the sake of clarity, beenillustrated. In operation, such a scalar processor core stores fixedlength 32-bit data values within the scalar register data store 4 andmanipulates these using the multiplier 6, shifter 8 and adder 10 undercontrol of data processing instructions passed along the instructionpipeline 12 and supplied to the scalar decoder 14. The scalar decoder 14produces control signals which control the operation of the scalarprocessing elements in a conventional way.

As illustrated in FIG. 1 the integrated circuit 2 includes variousdedicated SIMD processing elements including a SIMD register data store20, dedicated SIMD processing logic 18 and reordering logic 24. A loadstore unit 22 is shared with the scalar portion and could be the same ora modified version of the load store unit conventionally found within ascalar processor.

The instruction pipeline 12 is extended with additional pipeline stageswhich serve to control SIMD processing operation via a dedicated SIMDdecoder 16. (It will be appreciated that in other embodiments the SIMDpipeline may be provided in parallel with the scalar pipeline.) The SIMDdecoder 16 generates SIMD control signals which control the operation ofthe SIMD processing elements, such as reading of SIMD registers, writingof SIMD registers and the configuration of the SIMD processing logic soas to perform the desired data processing operations. The SIMD pipelinestages follow the scalar stages resulting in the SIMD portion of theprocessor effectively seeing a different execution point to the scalarportion. This can result in the need for some interlocking as will bediscussed below.

The reordering logic 24 serves the purpose of reordering data elementsretrieved from a memory (not illustrated) coupled to the integratedcircuit 2 in to an order more suited to the desired SIMD processingoperation. This reordering logic 24, its operations and advantages willbe discussed further below. There are also provided load and store FIFOs23 and 23′ between the load store unit 22 and the reordering logic 24.

The scalar register data store 4 can in this example be considered asbeing divided into a fixed number of fixed length registers, such as theconventional 16 32-bit ARM registers. In contrast, the SIMD registerdata store 20 provides a block of storage which may beaddressed/accessed in a flexible way depending upon the parametersassociated with the SIMD data processing instruction concerned. Moreparticularly, the SIMD data processing instruction specifies source anddestination register numbers, data element sizes and register sizesassociated with the data processing instruction. These parameters aretogether combined by the SIMD decoder 16 and read/write ports of theregister data store 20 to control the mapping of the different portionsand accordingly data elements stored within the SIMD register data store20 to the register being accessed. Thus, SIMD registers of differingsizes, differing data element sizes and the like can effectively bealiased together (i.e. these registers can be considered as overlappingand accessible via different register specifiers, register size and dataelement size combinations as may be desired. The SIMD decoder 16 and theread/write ports can be considered to provide register accessing logicin this example embodiment).

FIG. 2 schematically illustrates the read and write port arrangementwhich may be provided for the SIMD register data store 20. In thisexample thirty two SIMD registers are capable of being specified by theregister specifying field (5 bits) within the SIMD data processinginstructions. N read ports are associated with the SIMD register datastore 20. The minimum granularity supported is a 64-bit register value.In this example, the register sizes directly supported are 64-bits and128-bits. It will be readily apparent to those in this field that thisarrangement could be scaled to support 256-bit and higher register sizesdirectly, or indirectly by synthesis using supported instructions withsmaller sizes of register. FIG. 2 schematically illustrates Mde-multiplexers serving as write ports to the SIMD register data store20. It will be appreciated that in practice such de-multiplexers areprovided in the form of appropriately directed enable signals to rows ofstorage elements within the SIMD register data store together with theaction of multiplexers routing the desired inputs to their destination.

FIG. 3 illustrates a particular example in which two 64-bit SIMDregister values (denoted as a D double words) each containing multipledata elements are multiplied together to generate multiple output dataelements that are stored together in a 128-bit register (denoted as a Qquad word). Separate read ports are arranged to read the source SIMDregister values D₁ and D₂ from the SIMD register data store 20. Twowrite ports act together to respectively allow the first Q [63:0]portion and second Q [127:64] portion of the 128-bit result to bewritten back to the SIMD register store 20. It will be appreciated thatthe data element size within the D registers and the Q registers canvary. As an example, four 16-bit data elements may be contained withineach of the source D registers with the destination Q registercontaining a set of corresponding four 32-bit data elements being theresult of the multiplication. In this example it will be seen how thenumber of lanes of parallel processing (four) remains constant whilstthe data element size is increased from 16-bits to 32-bits as requiredby the multiplication operation being performed.

FIG. 4 illustrates various different types of relationship betweensource register size and destination register size which may besupported. In the uppermost example given the number of lanes ofparallel processing remains constant and the data element size remainsconstant. In the second and fourth examples the number of lanes ofparallel processing remains constant but the data element size changesbetween the source and the destination. In the third example the twosource elements have different data element sizes. The SIMD processingstructure and techniques of the present system support these differenttypes of data processing instruction as will be described further below.The final three examples are unary operations with a single inputvariable. The fifth example keeps the same data element size. The sixthexample doubles the data element size and the seventh example halves thedata element size.

FIG. 5 schematically illustrates the syntax of a SIMD data processinginstruction. The first portion of the syntax specifies the SIMD operatorconcerned, in this case a multiplication operation. This is followed bya field indicating the output data element size and othercharacteristics of the output data elements. In this example the outputdata elements are 16-bits in length and are signed integers. The nextfield indicates the input data element size and characteristics, in thiscase signed 8-bit integers. The next field indicates the destinationregister size and register specifier. In this example the 128-bit quadword SIMD register with the register specifier 12 is to be used as thedestination SIMD register. The two source SIMD registers are each doubleword 64-bit registers with the register specifiers respectively being“1” and “4”. Further information on the syntax is described below.

A set of data types to represent the different data formats are defined.These are described in Table 0. Most instructions use at least one datatype qualifier to determine the exact operation. However, operations donot necessarily support all data types. The data type is applied as asuffix to the fields indicating the data element size andcharacteristics.

TABLE 0 Data type Qualifier Interpretation .<size> Any element of <size>bits .I<size> Signed or unsigned modulo integer of <size> bits .F<size>Floating-point number of <size> bits .P<size> Polynomial over {0, 1} ofdegree less than <size> .S<size> Signed Integer of <size> bits .U<size>Unsigned Integer of <size> bits

FIG. 6 illustrates how the SIMD register data store 20 may be viewed asbeing divided into thirty two 64-bit registers or sixteen 128-bitregisters. These registers map to the same physical SIMD register datastore 20 and accordingly alias together. As an example, a data elementwithin register D0 may also be accessed as a data element withinregister Q0.

FIG. 7 schematically further illustrates the overlap between the 64-bitand 128-bit registers. As illustrated, a 128-bit register Q(n)corresponds to two 64-bit registers D(2n+1) and D(2n).

FIG. 8 schematically illustrates example data elements which may bestored within SIMD registers of differing sizes. In the upper portion ofFIG. 8, a 128-bit SIMD register is illustrated as either containing four32-bit data elements or eight 16-bit data elements. The data elementsmay be signed or unsigned integers, floating point numbers or otherformats of number as desired and suited to the parallel processing to beperformed.

The lower portion of FIG. 8 illustrates a 64-bit SIMD register which maycontain either two signed 32-bit integers or four unsigned 16-bitintegers. Many other possibilities are available and will be apparent tothose in the technical field.

FIG. 9 schematically illustrates how an individual scalar value within aSIMD register may be referenced. The illustrated SIMD register 26contains four signed integer values. If this SIMD register is consideredas register D_(n), then the different individual signed integer valuescan be denoted as D_(n)[3] to D_(n)[0]. Such referencing of individualdata elements within a SIMD register is used, for example, whenperforming register transfer instructions which select one of the dataelements within a SIMD register and move it to or from one of theregisters within the scalar register data store 4.

FIG. 10 illustrates how a SIMD data processing instruction may beperformed with the number of processing lanes remaining constant and thedata element size remaining constant between the two source registersand the destination register. In this example the source SIMD registersare D registers (64-bits and containing four 16-bit data elements)having four parallel processing lanes. The destination SIMD register isalso a 64-bit D register containing four result 16-bit data elementvalues.

In contrast to FIG. 10, FIG. 11A illustrates an example in which thedestination SIMD register is twice the width of the source SIMDregisters. The number of lanes of processing remains constant but thedata element size doubles. This type of behaviour is suited for use withSIMD operations such as multiply, add, subtract and shift (particularlyleft shift). FIG. 11B illustrates an example in which the destinationSIMD register is half the width of the source SIMD registers. This typeof instruction is useful for add and shifts (particularly right shifts).

The ability to alter data element size between source and destinationwhilst maintaining the number of processing lanes allows sequences ofSIMD data processing instructions to be built up without the requirementfor data element reordering or doubling up of instructions as aconsequence of changes in data element size produced by the dataprocessing operations performed. This is a significant advantage interms of processing speed, code density, power consumption and the like.

FIG. 12 schematically illustrates the scalar register data store 4 andthe SIMD register data store 20 coupled together by register transferlogic 28. Control signals received from either or both the scalardecoder 14 or the SIMD decoder 16 control the register transfer logic 28in response to register transfer instructions within the instructionpipeline 12 to move data between a specified register within the scalarregister data store 4 and a specified position within a specifiedregister of the SIMD register data store 20. A data value moving fromthe scalar register to the SIMD register may also be copied to allpositions within the SIMD register as is illustrated in FIG. 13. Thistype of register transfer instruction with duplication is well suited torapidly populating all processing lanes within a SIMD register withvalues, such as scaling values, which need to be applied to differentother operands within SIMD registers by the SIMD processing logic 18.

FIG. 14 illustrates a different type of register transfer instruction.In this example a 32-bit scalar value A is moved to a specified position(lane) within the SIMD register. The other lanes maintain their originalvalues. The scalar value is not duplicated across the entire scalarregister. The position within the destination scalar register can bechanged by an appropriate field value within the register transferinstruction. This type of operation allows an individual data elementwithin a SIMD register to be populated with a data value taken from thescalar register data store.

FIG. 15 illustrates a further type of register transfer instruction. Inthis example a 16-bit data element from within the SIMD register istaken from a specified variable position within that SIMD register andcopied to one of the scalar registers. Since the scalar register is a32-bit register, then the data element is in this example sign extended.The data element could instead be zero extended depending upon therequirements of the particular algorithm or system.

FIG. 16 is a flow diagram schematically illustrating an example type ofprocessing in which the register transfer instructions of FIG. 14 andFIG. 15 may be advantageously employed. At step 30 some SIMD processingis performed in parallel upon multiple lanes each containing their owndata elements. At some point this processing requires a datamanipulation to be performed which is either not supported by the SIMDprocessing logic 18 or can only be inefficiently so supported. In thiscircumstance it is desired to separately move the individual dataelements across to the scalar processing system to allow this complexdata operation to be performed. Step 32 selects the first data elementto be so moved. Step 34 then executes a register transfer instructionsuch as that illustrated in FIG. 15. Step 36 executes the desiredcomplex processing upon the individual data element now in the scalarportion of the system. When this complex processing has been completed,step 38 executes a register transfer instruction such as thatillustrated in FIG. 14 to return the now modified data element back toits original position. Step 40 determines whether the last data elementhas been reached, and if this is not the case the step 42 selects thenext data element before returning processing to step 34. If all of thedata elements which required the complex operation to be performed uponthem have been moved across to the scalar system, subject to the desiredprocessing and moved back to the SIMD system, then processing proceedsfrom step 40 to step 44 at which the parallel SIMD processing isresumed.

Data processing instructions specifying SIMD registers for accessing theregister data store include one or more register fields encoding aregister numver of a register to be accessed. The 5-bit registerspecifiers used are designed to be the same as those used by the ARMVector Floating Point (VFP) unit—that is, the instruction bits thatspecify a register are:

For Destination Registers:

-   D=bit[22]-   Rd=bits[15:12]    For First Source Register Specifiers:-   N=bit[7]-   Rn=bits[19:16]    For Second Source Register Specifiers:-   m=bit[5]-   Rm=bits[3:0]    Furthermore, the use of these bits is chosen so that Di registers    and word scalars are encoded consistently with the way that VFP    specifies double- and single-precision registers respectively, and    the encodings for Qi registers and halfword scalars follow the same    principles. The following describes how (D,Rd) are used; (N,Rn) and    (M,Rm) are used analogously:-   Qd: Qi register number is (D,Rd[3],Rd[2],Rd[1])-   Corresponding Di register numbers are (D,Rd[3],Rd[2],Rd[1],0) and    (D,Rd[3],Rd[2],Rd[1],1)-   Rd[0] Should Be Zero-   Dd: Di register number is (D,Rd[3],Rd[2],Rd[1],Rd[0])    Word Scalar:-   Di register number is (0,Rd[3],Rd[2],Rd[1],Rd[0])-   word[D] is selected from register on little-endian basis    Halfword Scalar:-   Di register number is (0,0,Rd[2],Rd[1],Rd[0])-   halfword[(D,Rd[3])] is selected from register on little-endian    basis.    Byte Scalar:-   Di register number is (0,0,0,Rd[1],Rd[0])-   byte[(D,Rd[3],Rd[2])] is selected from register on little-endian    basis.

Thus, the bits D, Rd[3], Rd[2], Rd[1] and Rd[0] may be considered asmappable to a 5-bit contiguous field which is rotatable by a number ofbit positions dependent upon the register size for the register number.In practice the register encoding bits are not mapped or rotated asseparate operations but are supplied to the reiger accessing logic toform a row address and a column address for accessing the register datastore with a movable mask being applied depending upon register size toselect the correct portions of the bit to serve as row and portioncolumn addresses.

In accordance with embodiments, load and store instructions are providedfor moving data between the SIMD register file 20 (see FIG. 1) andmemory. The load instructions can be used to load data elements frommemory into specified registers, whilst the store instructions are usedto store data elements from specified registers to memory. These loadand store instructions are designed to support the movement of datarequired by algorithms using the SIMD processing logic 18. The load andstore instructions of embodiments specify the size of data elements thatthey are loading and storing, and this information is used to provide aconsistent ordering within a register regardless of the endianness ofthe memory system.

The load and store instructions of embodiments allow a number of dataelements from a continuous block of memory to be loaded into or storedfrom the SIMD register file 20. In accordance with one embodiment,accesses can be performed at any byte alignment, and load or store up to32 bytes.

The load and store instructions of embodiments are considered to accessthe data from memory in which the data elements are arranged intostructures, with each structure having a number of components. Inaccordance with one embodiment, the structures in memory can containbetween one and four components where a component can have any data typesize that is recognised by the SIMD processing logic 18, in preferredembodiments these data type sizes being 8, 16, 32 or 64-bits. Somecommon examples of structure formats used in embodiments are shown inthe following table:

TABLE 1 Format Description (a) Single component (x, y) 2-D PositionCoordinate (real, imm) Complex Number (x, y, z) 3-D Vector (r, g, b)Pixel (x, y, z, w) 4-D Vector

For any particular load or store instruction, each structure in memorythe subject of the access will have the same structure format, andaccordingly will include the same number of components. The load andstore instructions are arranged to identify the number of components inthe structure format, and this information is used by the reorderinglogic 24 to provide de-interleaving of data elements when performingload operations, and interleaving of data elements when performing storeoperations, allowing data to be arranged in registers such that thedifferent data elements of the structure appear in different registers.This concept is illustrated schematically in FIG. 17 for the situationof a load instruction used to load a number of data elements from acontinuous block of memory into three specified registers. In thisexample, the specified registers are the three 64-bit registers D0 220,D1 225 and D2 230. In this example, the structure format is a 3D vectorformat, and accordingly each structure 210 in the memory 200 has threecomponents 215.

As shown in FIG. 1, the load instruction is routed from the instructionpipeline 12 to the scaler decoder 14, resulting in appropriate memoryaccess control signals being sent to the load store unit (LSU) 22. TheLSU then accesses the required four structures A[0], A[1], A[2], andA[3] from a continuous block of memory. Accordingly, the LSU 22 canoperate in its normal manner. Thereafter, the data is routed via thereordering logic 24 which is arranged to de-interleave the threecomponents in each structure, such that data elements pertaining to theX component are routed to register D0 220, data elements of the Ycomponent are routed to register D1 225, and elements of the Z componentare routed to register D2 230.

The ability to load from an array of structures and separate theinformation into separate registers as part of the load operation can beused to allow data to be immediately ready for efficient SIMDprocessing.

The reordering logic 24 is also arranged to perform an analogous processwhen storing data from specified registers back to the continuous blockof memory, in this instance the reordering logic 24 performing aninterleaving operation in order to reproduce the structure format priorto the data being stored in memory.

As can be seen from FIG. 1, the load instructions are routed from theinstruction pipeline to the scalar decoder 14 prior to thoseinstructions reaching the SIMD stages of the instruction pipeline 12.This enables the process of loading the data into the SIMD registerfiles 20 to occur earlier than would otherwise be possible, and has thebenefit that a subsequent SIMD processing instruction will not typicallyhave to wait for the data to be loaded before it can begin execution,thereby significantly reducing the latency of load operations. Storeinstructions however will need to be passed through the instructionpipeline until they can be routed to the SIMD decoder 16, from whereappropriate control signals can be used to control the accessing of thedata from the SIMD register files 20, and the appropriate reorderingwithin the reordering logic 24 prior to the data being stored via theLSU 22 back to the memory. However, certain parts of the storeinstruction can be performed whilst in the ARM portion of theinstruction pipeline 12, for example checking the address, memory accesspermissions, etc., to ensure that the instruction will not cause a dataabort.

The load and store instructions of embodiments can be viewed asfollowing a single syntax. The syntax can be expressed as follows:

V(LD|ST)<st>.<dt>{@<a>} <reglist>, { <n>,} <addr> where <st> TheStructure Format Data elements in memory are considered as an array ofstructures having <st> components. This information is used tointerleave and de-interleave data elements as they move between memoryand the SIMD register store to enable efficient SIMD processing. <dt>The Data Type This determines the size of the data elements being loaded<a> An Alignment Specifier (optional) <reglist> The SIMD Register ListThis determines the SIMD register state that will be written to or readfrom. For loads, this is precisely the parts of the SIMD register filethat will be affected by the instruction. The register list isconsidered a collection of data elements of size <dt>, split in to <st>vectors of equal length. Note that the number of bytes within theregister list is not necessarily the same as the number of bytes ofmemory accessed. See the <n> options and FIGS. 20A to 20C. <n> Number ofStructures (optional) This defines the number of structures to load orstore. This allows a register list to only partially be loaded withmemory data, and the remaining parts be zeroed. When it is not supplied,it takes the default value which means the register list and memoryaccess size are the same. default <n> := elements<dt>(<reglist>) / <st><addr> The Addressing Mode used for the access In accordance withembodiments, the addressing mode can take a variety of forms, and inparticular the three forms illustrated below: ;// <addr> [Rn] ;//address := Rn [Rn]! ;// address := Rn, Rn := Rn + transfer_size (where“transfer_size” is the amount of memory accessed) [Rn], Rm ;// address:= Rn, Rn := Rn + Rm

The semantics discussed above allow single structures or multiplestructures to be loaded or stored, logical zeros to be written toremaining parts of registers that are not filled with data from memory,and insertion into registers by using a register list containing scalerqualifiers (e.g. D0[1]). It will be appreciated that in embodiments theactual load and store instructions that are provided will typically be asubset of all possible combinations of the above syntax.

With regard to the structure format, FIG. 18 illustrates three possibleexamples of structure format, and their corresponding “st” value. As canbe seen from FIG. 18, the first structure 250 has only a singlecomponent, and accordingly the st value is one. In the second example,the structure 255 has two components, for example representing real partx and imaginary part y of a complex number, and accordingly the st valueis two. Finally, in the third example, the structure 260 has threecomponents, representing R, G and B data elements, and accordingly thest value is three.

To help illustrate some of the functionality available when using theload and store instructions of embodiments, FIGS. 19 to 22 illustratespecific examples of load and store instructions. Considering firstFIGS. 19A to 19C, FIG. 19A illustrates the reglist states specified by astore instruction

VST 2.16 {D0, D1, D2, D3}, [r1]

This instruction is used to store multiple structures from the specifiedregister files to a continuous block of memory. As can be seen, FIG. 19Aidentifies that the reglist contains four specified registers D0 270, D1280, D2 290 and D3 300. As shown in FIG. 19B, these registers can beconsidered as being split into “st” vectors (i.e. 2) of “dt” sized (i.e.16-bit) data elements. In register D0, these data elements arereferenced by the numeral 275, in D1 by the numeral 285, in D2 by thenumeral 295 and in D3 by the numeral 305. As can be seen from FIG. 19C,the reordering logic 24 is arranged to interleave data elements fromthese two vectors so that each data element 314 is stored to the memory310 in the required structure format for the structure 312.

FIGS. 20A to 20C are a similar set of diagrams illustrating theoperation performed by the instruction

VLD2.16 {D0, D1}, #1, [r1]

FIG. 20A illustrates the collection of the reglist state, identifyingthe registers D0 270 and D1 280. FIG. 20B then illustrates how theseregisters are split into st vectors (i.e. 2) of dt sized (i.e. 16-bit)data elements.

In contrast to the example of FIGS. 19A to 19C, this instructionspecifies an “n” parameter identifying the number of structures to beaccessed, in this example n being 1. Accordingly, for this loadinstruction, n×st (i.e. 1×2) data elements need to be read from memorybeginning at the effective address and to then be distributed into thevectors in a round-robin allocation beginning at the lowest indexedelement of the first vector. This process is illustrated in FIG. 20C,and results in the data element x_(o) of the first component 314 beingwritten into the lowest 16 bits of the register D0, whilst the dataelement y_(o) of the second component is written to the lowest 16 bitsof the register D1. In accordance with this embodiment, any parts of theregister state not written to once all of the data elements have beenloaded are set to zero. It should be noted that for the equivalent storeinstruction, n×st data elements are stored in the reverse manner to theloads.

FIGS. 21A to 21C illustrate another particular example in which thesyntax for the instructions is extended to allow two data types to bespecified, namely the data type for the data elements being accessed andthe data type for the resultant data elements to be loaded into theregisters, or stored to memory. Accordingly, FIGS. 21A to 21C illustratethe operation performed by the instruction

VLD 2.32.S16 {D0, D1, D2, D3}, [r1]

As shown in FIG. 21A, the reglist state is collected, identifyingregisters D0 270, D1 280, D2 290 and D3 300. Then, as shown by FIG. 21B,this register state is split into st vectors (i.e. 2) of dt sized (i.e.32-bit) data elements, since this instruction specifies that by the timethe data elements are stored within the registers, they will be 32 bitsin length.

As also specified by the instruction, the data elements in memory are16-bits in length, and accordingly once the data elements have beenaccessed from the memory 310, they will be passed through sometransformation logic 340 (which optionally can be incorporated as partof the reordering logic 24) which is used to then extend each of the16-bit data elements to form new 32-bit data elements 342. These dataelements are de-interleaved so that data elements of the first componentare stored within registers D0 and D1, whilst data elements of thesecond component are stored within registers D2 and D3.

FIGS. 22A to 22C illustrate a further example, and in particularillustrate the operation of the instruction.

VLD2.16 {D0[2], D1[2]}, [r1]

Whilst this instruction can share the same syntax as the previousinstructions, this instruction is conceptually a different type ofinstruction, in that rather than loading data elements from a continuousblock of memory in which the data elements are stored as an array ofstructures, this load instruction only loads a single structure.Further, the data elements of the single structure that are loaded canbe placed into any chosen lane of processing within the specifiedregisters. Hence, when considering 64-bit wide registers, and 16-bitdata elements, there are four possible lanes of processing within whichthe data elements can be placed. In preferred embodiments, the chosenlane for the particular instruction is indicated within the reglist databy identifying the particular lane.

Considering FIG. 22A, it can be seen that when the reglist state iscollected, this identifies lane 2 320 of register D0, and lane 2 325 ofregister D1. As shown in FIG. 22B, these are then split into st vectors(i.e. 2) of dt sized (i.e. 16-bit) data elements. Thereafter, as shownin FIG. 22C, once the structure 312 has been accessed from the memory310, the reordering logic 24 is arranged to direct the data elementx_(o) to lane 2 of the D0 register 330, whilst directing the dataelement y_(o) to lane 2 of the D1 register 335. In this example, it willbe appreciated that the lanes can be identified in the range from 0 to3.

For the interested reader, the following tables identify various typesof load and store instructions that may be provided in one particularembodiment:

TABLE 2 Mnemonic Data Type Operand Format Description VLD1 .8 <list>,<addr> Load multiple elements .16 .32 <list> := .64  {D_(n)} | {D_(n),D_(n+1)} | {D_(n), D_(n+1), D_(n+2)} | {D_(n), D_(n+1), D_(n+2),D_(n+3)} VLD1 .8 <list>, #UIMM, <addr> Load multiple elements and Zero.16 UIMM_1reg = (1)..(a−1) .32 <list> := UIMM_2reg = (a+1)..(b−1) {D_(n)} where | {D_(n), D_(n+1)} a = (64/size<dt>) b = (128/size<dt>)VLD1 .8 Dd[x], <addr> Load single element .16 .32 VST1 .8 <list>, <addr>Store multiple elements .16 .32 <list> := .64  {D_(n)} | {D_(n),D_(n+1)} | {D_(n), D_(n+1), D_(n+2)} | {D_(n), D_(n+1), D_(n+2),D_(n+3)} VST1 .8 <list>, #UIMM, <addr> Store multiple elements .16UIMM_1reg = (2)..(a−1) UIMM_2reg = (a+1)..(b−1) .32 <list> := where {D_(n)} a = (64/size<dt>) | {D_(n), D_(n+1)} b = (128/size<dt>) VST1 .8Dd[x], <addr> Store single element .16 .32 VST1 Examples VLD1.16 D0,[R1] VLD1.8 {D0, D1}, [R2]! VLD1.8 Q2, #10, [R2], R7 VLD1.16 D20[3],[R8], R1 VST1.32 {D8, D9, D10, D11}, [R0]! VST1.32 Q7, #3, [R10] VST1.8D30[0], [R0], R14

TABLE 3 Mnemonic Data Type Operand Format Description VLD2 .8 <list>,<addr> Load multiple 2-element structures .16 .32 <list> :=  {D_(n),D_(n+1)} | {D_(n), D_(n+2)} | {D_(n), D_(n+1), D_(n+2), D_(n+3)} VLD2 .8<list>, #1, <addr> Load single 2-element structure and Zero .16 .32<list> :=  {D_(n), D_(n+1)} | {D_(n), D_(n+2)} VLD2 .8 <list>, <addr>Load single 2-element structure .16 where .32 <list> := list {D_(n)[x],D_(n+2)[x]} not available  {D_(n)[x], D_(n+1)[x]} when dt = 8 |{D_(n)[x], D_(n+2)[x]} VST2 .8 <list>, <addr> Store multiple 2-elementstructures .16 .32 <list> :=  {D_(n), D_(n+1)} | {D_(n), D_(n+2)} |{D_(n), D_(n+1), D_(n+2), D_(n+3)} VST2 .8 <list>, <addr> Store single2-element structure .16 where .32 <list> := list {D_(n)[x], D_(n+2)[x]}not available when dt = 8  {D_(n)[x], D_(n+1)[x]} | {D_(n)[x],D_(n+2)[x]} Examples VLD2.16 {D0, D1}, [R1] VLD2.32 {D2, D3, D4, D5},[R3]! VLD2.8 {D0, D1}, #1, [R1], R7 VLD2.16 {D2[1], D4[1]}, [R6] VST2.8{D20, D21}, [R0] VST2.32 {D20[0], D21[0]}, [R5], R6

TABLE 4 Mnemonic Data Type Operand Format Description VLD3 .8 <list>,<addr> Load multiple 3-element structures .16 .32 <list> :=  {D_(n),D_(n+1), D_(n+2)} | {D_(n), D_(n+2), D_(n+4)} VLD3 .8 <list>, #1, <addr>Load single 3-element structure and Zero .16 .32 <list> :=  {D_(n),D_(n+1), D_(n+2)} | {D_(n), D_(n+2), D_(n+4)} VLD3 .8 <list>, <addr>Load single 3-element structure .16 where .32 <list> := list {D_(n)[x],D_(n+2)[x], D_(n+4)[x]} not available when dt = 8  {D_(n)[x],D_(n+1)[x], D_(n+2)[x]} | {Dn[x], D_(n+2)[x], D_(n+4)[x]} VST3 .8<list>, <addr> Store multiple 3-element structures .16 .32 <list> :={D_(n), D_(n+1), D_(n+2)} {D_(n), D_(n+2), D_(n+4)} VST3 .8 <list>,<addr> Store single 3-element structure .16 where .32 <list> := list{D_(n)[x], D_(n+2)[x], D_(n+4)[x]} not available when dt = 8 {D_(n)[x],D_(n+1)[x], D_(n+2)[x]}  | {D_(n)[x], D_(n+2)[x], D_(n+4)[x]} ExamplesVLD3.8 {D0, D1, D2}, [R1]! VLD3.16 {D2, D3, D4}, #1, [R3], R4 VLD3.16{D2[1], D3[1], D4[1]}, [R3], R4 VST3.32 {D20, D22, D24}, [R7] VST3.8{D0[0], D1[0], D2[0]}, [R10], R14

TABLE 5 Mnemonic Data Type Operand Format Description VLD4 .8 <list>,<addr> Load multiple 4-element structures .16 .32 <list> :=  {D_(n),D_(n+1), D_(n+2), D_(n+3)} | {D_(n), D_(n+2), D_(n+4), D_(n+6)} VLD4 .8<list>, #1, <addr> Load single 4-element structure and Zero .16 .32<list> :=  {D_(n), D_(n+1), D_(n+2), D_(n+3)} | {D_(n), D_(n+2),D_(n+4), D_(n+6)} VLD4 .8 <list>, <addr> Load single 4-element structure.16 where .32 <list> := list {D_(n)[x], D_(n+2)[x], D_(n+4)[x],D_(n+6)[x]} not available when dt = 8  {D_(n)[x], D_(n+1)[x],D_(n+2)[x], D_(n+3)[x]} | {D_(n)[x], D_(n+2)[x], D_(n+4)[x], D_(n+6)[x]}VST4 .8 <list>, <addr> Store multiple 4-element structures .16 .32<list> :=  {D_(n), D_(n+1), D_(n+2), D_(n+3)} | (D_(n), D_(n+2),D_(n+4), D_(n+6)} VST4 .8 <list>, <addr> Store single 4-elementstructure .16 where .32 <list> := list {D_(n)[x], D_(n+2)[x],D_(n+4)[x], D_(n+6)[x]} not available when dt = 8  {D_(n)[x],D_(n+1)[x], D_(n+2)[x], D_(n+3)[x]} | {D_(n)[x], D_(n+2)[x], D_(n+4)[x],D_(n+6)[x]} Examples VLD4.8 {D0, D1, D2, D3}, [R1]! VLD4.16 {D2, D3, D4,D5}, #1, [R3] VLD4.16 {D2[1], D4[1], D6[1], D8[1]}, [R3], R4 VST4.32{D20, D22, D24, D26}, [R7] VST4.8 {D20[5], D21[5], D22[5], D23[5]},[R1], R4

In one embodiment, the reordering logic 24 of FIG. 1 takes the formillustrated in FIG. 23. The logic of FIG. 23 includes two multiplexers350, 355 at its inputs, which in the event of a load instruction arearranged to receive data from a load FIFO 23 associated with the LSU 22illustrated in FIG. 1, or in the event of a store instruction arearranged to receive data from the SIMD register store 20. Further, insome situations, a load instruction may also cause the logic of FIG. 23to receive data from the SIMD register store 20. The multiplexers 350,355 are controlled to choose between the different inputs, and to routethe chosen inputs to the associated input registers 360, 365. In oneembodiment, each input register is able to store 64 bits of data. Thedata stored in the input registers is then read through the crossbarmultiplexer 375 into the register cache 380, crossbar control register370 providing drive signals to the crossbar multiplexer to directindividual bytes of data received from the input registers to desiredbyte locations within the register cache. The values in control register370 are derived by the instruction decoder.

As shown in FIG. 23, the register cache 380 can be considered asconsisting of four registers, and in one embodiment each register is 64bits in length.

After data has been stored in the register cache 380, it can then beread via output multiplexers 385 to either the store data FIFO 23′associated with the LSU 22 (in the event of a store instruction), or theSIMD register file 20 (in the event of a load instruction).

Whilst the byte crossbar multiplexer 375 can read the input registers atbyte granularity and write into the register cache at byte granularity,the write multiplexers 385 read from the register cache at 64-bitgranularity.

The reordering logic 24 is largely autonomous from the rest of the SIMDprocessing logic 18, but is given instructions in program order in thesame fashion as other functional units within the integrated circuit. Inone embodiment, it has two register file read ports and two write portswhich it controls itself. In order that hazards are detected and avoidedthe reordering logic 24 may be arranged to communicate with someinterlock logic (not shown) using scoreboards.

Store instructions from the SIMD register file 20 are performedout-of-order with respect to other SIMD instructions, but remainin-order with respect to other store instructions from the SIMD registerfile. Pending stores are kept in a queue, and when the store data isready it is read and passed into the store FIFO 23′ associated with theLSU 22 via the reordering logic 24.

In one embodiment, all data passing between memory and the SIMD registerfile 20 is routed via the reordering logic 24. However, in analternative embodiment, a bypass path around the reordering logic 24 maybe provided for situations where it is determined that no reordering isrequired.

The register cache 380 is referred to as a “cache” since under certainconditions it caches register values before they are written to the SIMDregister file 20. The register cache holds data in the format that datais to be output from the reordering logic 24.

FIGS. 24A to 24C illustrate the operation of the reordering logic 24 toimplement the necessary reordering required when performing aninstruction of the type VLD 3.16 {D0, D1, D2}, [r1].

Once the data has been loaded by the LSU 22, then in a first cycle (asshown in FIG. 24A) 64 bits of the retrieved data is loaded viamultiplexer 350 into the input register 360, whilst the next 64 bits areloaded via the multiplexer 355 into the input registers 365. In theexample illustrated in FIGS. 24A through 24C, it is assumed that thestructure format represents a 3D vector having components x, y, z. Inthe next cycle, as shown in FIG. 24B, the 16-bit data elements withinthe input registers are read into the register cache 380 via the bytecrossbar multiplexer 375 which reorders the data so that any dataelements relating to x components are placed in a first register, anydata elements relating to y components are placed in a second register,and any data elements relating to z components are placed in a thirdregister of the register cache. Also during this cycle, the next 64 bitsof data from the load FIFO 23 are loaded via multiplexer 350 into theinput register 360.

In the next cycle, as shown in FIG. 24C, the data elements from theinput register 360 are routed through the byte crossbar multiplexer intothe register cache, with the x, y and z components being de-interleavedas discussed earlier. As shown in FIG. 24C, this results in the registercache containing four x components in a first register, four ycomponents in a second register, and four z components in a thirdregister. The contents of the register cache can then be output via thewrite multiplexers 385, two registers at a time, to the registersspecified by the load instruction.

FIGS. 25A–25D illustrate a second example of the flow of data throughthe reordering logic in order to perform the necessary reorderingrequired when executing the instruction VLD 3.16 {D0[1], D1[1], D2[1]},[r1]. In accordance with this instruction, data is going to be loadedinto a particular lane of the registers D0, D1 and D2, namely the second16-bit wide lane of four 16-bit wide lanes within those registers.Before a data element can be stored in a particular lane of a register,the current contents of the register need to be retrieved, so that whenthe register is subsequently written to, the contents of the registerare written as a whole. This feature avoids the need to provide for anywriting to only a portion of a register in the SIMD register file 20.Accordingly, during a first cycle, as shown in FIG. 25A, the currentcontents of the registers D0 and D1 are read from the SIMD register filevia the multiplexers 350, 355 into the input registers 360, 365. In thenext cycle, as shown in FIG. 25B, these contents are read into theregister cache 380 through the crossbar multiplexer 375 with thecontents of D0 being placed in a first register and the contents of D1being placed in a second register of the register cache. During the samecycle, the contents of the register D2 are retrieved from the SIMDregister file via the multiplexer 350 and stored in the input register360.

In the next cycle, as shown in FIG. 25C, the contents of the register D2are read into the register cache 380 via the crossbar multiplexer 375,such that they are stored in a third register of the register cache.During the same cycle, the data structure the subject of the load, whichtypically will have already have been retrieved by the LSU, is read fromthe load FIFO 23 via the multiplexer 350 into the input registers 360.In the example illustrated in FIG. 25C, it is again considered that thestructure in memory represents 3D vector data with components x, y andz. In the next cycle, as shown in FIG. 25D, the x, y and z componentsare read into the second lane of data elements via the crossbarmultiplexer 375, so that the data element x₀ overwrites within theregister cache the previous contents of the second lane of register D0,the component y₀ overwrites within the register cache the data elementpreviously in the second lane of the register D1, and the component z0overwrites within the register cache the data element previously storedin the second lane of the register D2.

It will be appreciated that at this point the actual contents of theregisters D0, D1 and D2 in the SIMD register file have not yet changed.However, the data stored in the register cache can now be output via thewrite multiplexers 385 back to the registers D0, D1, D2 to overwrite theprevious contents. As a result, it can be seen that a single loadinstruction can be used to load the components of a particular structurefrom memory, and to then insert the individual components of thatstructure into different registers at a chosen lane location.

FIGS. 25E to 25H illustrate a third example of a flow of the datathrough the reordering logic in order to perform the necessaryreordering required when executing the complementary store instructionto the load instruction that was discussed earlier with reference toFIGS. 25A to 25D. Accordingly, FIGS. 25E to 25H illustrate the stepsrequired to perform the necessary reordering when executing theinstruction VST 3.16 {D0[1], D1[1], D2[1]}, [r1]. Hence, in accordancewith this instruction, data is going to be stored from the second 16-bitwide lane of the registers D0, D1 and D2 back to memory. As shown inFIG. 25E, during a first cycle, the current contents of the registers D0and D1 are read from the SIMD register file via the multiplexers 350,355 into the input registers 360, 365. In the next cycle, as shown inFIG. 25F, the data elements in the second lane, i.e. the values x₀ andy₀, are read into a first register of the register cache 380 through thecrossbar multiplexer 375. During the same cycle, the contents of theregister D2 are retrieved from the SIMD register file via themultiplexer 350 and stored in the input register 360.

In the next cycle, as shown in FIG. 25G, the data element in the secondlane of register D2 is read into the first register of the registercache 380 via the crossbar multiplexer 375. Then, in the next cycle, asshown in FIG. 25H, the x, y and z components can now be output by thewrite multiplexers 385 to the LSU for storing back to memory. It will beappreciated that at this stage the data elements have now been reorderedinto the structure format required for storage in memory.

FIGS. 26A to 26E illustrate the reordering that takes place within thereordering logic during execution of the following sequence of fourinstructions:

VLD 3.16 {D0, D1, D2}, #1, [r1]

VLD 3.16 {D0 [1], D1 [1], D2 [1]}, [r2]

VLD 3.16 {D0 [2], D1 [2], D2 [2]}, [r3]

VLD 3.16 {D0 [3], D1 [3], D2 [3]}, [r4]

Once the data identified by the first load instruction has beenretrieved by the LSU, it is read via the multiplexer 350 into the inputregister 360 during a first cycle (see FIG. 26A). In the next cycle, itis read into the register cache 380 via the crossbar multiplexer 375,such that the x, y and z components are placed in different registers ofthe register cache. The “#1” within the first instruction signifies thateach data element should be placed in the least significant data lanesof each register, and that the remaining lanes should be filled withlogic 0 values, this being shown in FIG. 26B. Also during this cycle,the data elements identified by the second load instruction areretrieved into the input register 360. During the next cycle (see FIG.26C), the data elements stored in the input register 360 are moved intothe register cache 380 via the cross bar multiplexer 375, where they arestored in the second lane. Also during this cycle, the data elements ofthe third load instruction are placed within the input register 360.

In the next cycle, the contents of the input register 360 are routed viathe crossbar multiplexer 375 into the third lane of the register cache,whilst the data elements of the subject of the fourth load instructionare retrieved into the input register 360. This is shown in FIG. 26D.

Finally, as shown in FIG. 26E, in the next cycle these data elements arerouted via the crossbar multiplexer 375 into the register cache 380,where they are stored in the fourth lane. Thereafter, the 64-bit widechunks of data in each register of the register cache can be output tothe specified registers of the SIMD register file.

It should be noted that in contrast to the approach taken in FIGS. 25Ato 25D, the use of the first VLD instruction illustrated with referenceto FIGS. 26A to 26E, whereby once the data elements have been placed ina particular lane, the remaining lanes are filled with 0 values, avoidsthe need to retrieve from the SIMD register file the current contents ofany of the registers D0 to D2 before any updates are made. From a reviewof FIGS. 26A to 26E, it can be seen that the register cache 380 in thisinstance acts as a “write through cache”, since it caches the dataelements for a sequence of load instructions, and when each instructionis completed, writes the data to the relevant registers of the SIMDregister file. However, the register file does not typically need to beread from whilst each subsequent instruction in the sequence is beingperformed.

It is often required in data processing to reduce a so-called vector ofelements to a single element by applying a commutative and associativeoperator ‘op’ between all the elements. This will be described as afolding operation. Typical examples of folding operations are to sum theelements of a vector, or find the maximum value of the elements in avector.

In a parallel processing architecture, one known approach used toperform such a folding operation is described with reference to FIG. 27.The data elements [0] to [3] to be folded are contained a register r1.It will be appreciated that a benefit of parallel processingarchitectures is that it can enable the same operation to be performedconcurrently on multiple data elements. This is concept can be moreclearly understood with reference to so-called parallel processinglanes. In this example, each parallel processing lane contains one ofthe data element [0] to [3].

Firstly, at step A, a first instruction is issued which causes rotationof the data elements by two places to form rotated data elements inregister r2. This places different data elements in each processing laneso that Single Instruction Multiple Data (SIMD) operation can be appliedat step B.

Thereafter, at step B, a second instruction is issued which causes aSIMD operation to be performed on the data elements in each lane. Inthis example, the resultant data elements of these multiple paralleloperations are stored in register r3. Accordingly, it can be seen thatentries in r3 now contain the results of the combination of half of dataelements of the register r1 (i.e. r3 contains: [0] op [2]; [1] op [3];[2] op [0]; and [3] op [1]).

Next, a third instruction is issued which causes the results stored inthe register r3 to be rotated by one parallel processing lane at step Cand stored in the register r4. Once again, the rotation of the dataelements of stored in r3 with respect to those of r4 enables differentdata elements to occupy the same parallel processing lane.

Finally, at step D, a fourth instruction is issued which causes afurther single instruction multiple data operation to be performed ondata elements stored in each lane and the results are stored in registerr5.

Accordingly, it can be seen that by using just four instructions all thedata elements across the register can be combined and the results storedin each entry in the register r5 (i.e. each entry in r5 contains: [0] op[1] op [2] op [3]). The resultant data element can be read as requiredfrom any of the four entries in the register r5.

FIG. 28 illustrates the principle of a folding instruction of oneembodiment. Unlike the conventional arrangement of parallel processinglanes (which is described with reference to FIG. 27) in which eachparallel processing lane has a fixed width throughout the lane which isequal to the width of one data element, in this embodiment thearrangement of the parallel processing lanes differs. In this newarrangement, the width of each parallel processing lane at its input isequal to the width of at least two source data elements and at itsoutput is generally equal to the width of one resultant data element. Ithas been found that arranging the parallel processing lanes in this wayprovides significant advantages over prior art arrangements since groupsof data elements (for example pairs of data elements) within a singleregister can be the subject of parallel processing operations. As willbe clear from the discussion below, this obviates the need to performthe data manipulation operations of the prior art arrangements (i.e. therotation operations) since there is no need to arrange data elements inthe correct entry locations in further registers in order to enablemultiple operations to occur in parallel.

Accordingly, source data elements d[0] to d[3] are provided inrespective entries in a register. The adjacent source data elements d[0]and d[1] can be considered as a pair of source data elements. The sourcedata elements d[2] and d[3] can also be considered as a pair of sourcedata elements. Hence, in this example, there are two pairs of sourcedata elements.

At step (A) an operation is performed on each pair of source dataelements within the register in order to generate a resultant dataelement, the same operation occurring on each adjacent pair of sourcedata elements.

Hence, it will be appreciated that the pair of source data elements andthe corresponding resultant data element all occupy the same lane ofparallel processing. It can be seen that after step (A) the number ofresultant data elements is half that of the number of source dataelements. The data elements d[2] op d[3] and d[0] op d[1] can also beconsidered as a pair of source data elements.

At step (B) a further identical operation is performed on a pair ofsource data elements in order to generate a resultant data element d[0]op d[1] op d[2] op d[3]. It can be seen that after step (B) the numberof resultant data elements is also half that of the number of sourcedata elements. As mentioned previously, the operations are commutativeand associative operations and so the same resultant data elements aregenerated irrespective of the exact order of combination of the sourcedata elements.

Hence, it can be seen that the number of source data elements can behalved as a result of each operation and that the same operation can beperformed on those source data elements in order to produce the requiredresult. Accordingly, it can be seen that the required resultant dataelement can be generated in just two operations whereas the prior artarrangement of FIG. 27 needed to perform at least four operations. Itwill be appreciated that this improvement in efficiency is achievedthrough performing parallel processing operations on groups of dataelements within a source register. Although just two pairs of sourcedata elements have been illustrated for reasons of clarity, it will beappreciated that any number of pairs of source data elements could havebeen the subject of the operation. Also, whilst operations on pairs ofsource data elements have been illustrated for reasons of clarity, itwill be appreciated that any number of source data elements (e.g. three,four or more) could have been the subject of the operation.

In practice, for efficiency reasons, the folding instruction is arrangedto perform parallel operations on a minimum number of data elements,determined by the smallest supported register size in the register datafile 20. FIG. 29 illustrates an implementation which generates the samenumber of resultant data elements as the number of source data elements.

Source data elements d[0] to d[3] are provided in a register D_(n). Inorder to generate the same number of resultant data elements, the sourcedata elements d[0] to d[3] are also provided in a register D_(m). Itwill be appreciated that the registers D_(n) and D_(m) are likely to bethe same register with the SIMD processing logic 18 reading each sourcedata element from the register D_(n) twice in order to generateduplicated resultant data elements.

At step (A), a single SIMD instruction is issued, each pair of sourcedata elements have an operation performed thereon and a correspondingresultant data element is generated.

At step (B), another single SIMD instruction is issued to cause eachpair of source data elements to have an operation performed thereon inorder to generate a corresponding resultant data element.

Accordingly, it can be seen that all the source data elements have beencombined to produce resultant data elements.

FIGS. 30 a to 30 d illustrate the operation of various foldinginstructions which follow the same syntax described elsewhere. It willbe appreciated that where two source registers are indicated that thesemay be the same register. Also, it will be appreciated that each sourceregister could be specified as the destination register in order toreduce the amount of register space utilised.

FIG. 30 a illustrates the operation of a SIMD folding instructionwhereby pairs of source data elements from the same register,represented by ‘n’ bits, have an operation performed thereon in order togenerate resultant data elements represented by 2n bits. Promoting theresultant data elements to have 2n bits reduces the probability that anoverflow will occur. When promoting the resultant data elements, theyare typically sign-extended or padded with 0's. The following examplesumming folding instructions support such an operation:

Mnemonic Data Type Operand Format Description VSUM .S16.S8 Dd, Dm (addadjacent pairs of elements and promote) .S32.S16 Qd, Qm .S64.S32 .U16.U8.U32.U16 .U64.U32

In the particular example shown in FIG. 30 a (VSUM.S32.S16 Dd, Dm), a64-bit register Dm containing four 16-bit data elements are folded andstored in a 64-bit register Dd containing two 32-bit resultant dataelements.

FIG. 30 b illustrates the operation of a SIMD folding instructionwhereby pairs of source data elements from different registers,represented by ‘n’ bits, have an operation performed thereon in order togenerate resultant data elements also represented by ‘n’ bits. Thefollowing example summing, maximum and minimum instructions support suchan operation:

Mnemonic Data Type Operand Format Description VSUM .I8 Dd, Dn, Dm (addadjacent pairs of elements) .I16 .I32 .F32 VFMX .S8 Dd, Dn, Dm (takemaximum of adjacent pairs) .S16 .S32 .U8 .U16 .U32 .F32 VFMN .S8 Dd, Dn,Dm (take minimum of adjacent pairs) .S16 .S32 .U8 .U16 .U32 .F32

In the particular example shown in FIG. 30 b (VSUM.I16 Dd, Dn, Dm), two64-bit registers Dm, Dn, each containing four 16-bit data elements arefolded and stored in a 64-bit register Dd containing four 16-bitresultant data elements.

FIG. 30 c illustrates the operation of a SIMD folding instructionwhereby pairs of source data elements from the same register,represented by ‘n’ bits, have an operation performed thereon in order togenerate resultant data elements also represented by ‘n’ bits. In theparticular example shown in FIG. 30 c, a 128-bit register Qm containingeight 16-bit data elements are folded and stored in a 64-bit register Ddcontaining four 16-bit resultant data elements.

FIG. 30 d illustrates the operation of a SIMD folding instructionsimilar to FIG. 30 b, but where Dm=Dn which causes the resultant datavalues to be duplicated in the destination register. Pairs of sourcedata elements from the same register, represented by ‘n’ bits, have anoperation performed thereon in order to generate resultant data elementsalso represented by ‘n’ bits, each of which is duplicated in anotherentry in the register. In the particular example shown in FIG. 30 d, a64-bit register Dm containing four 16-bit data elements are folded andstored in a 64-bit register Dd containing two sets of two 16-bitresultant data elements.

FIG. 31 illustrates schematically example SIMD folding logic which cansupport folding instructions and which is provided as part of the SIMDprocessing logic 18. For sake of clarity, the logic shown is used tosupport instructions which select the maximum of each adjacent pair.However, it will be appreciated that the logic can be readily adapted toprovide support for other operations, as will be described in moredetail below.

The logic receives source data elements (Dm[0] to Dm[3]) from theregister Dm, optionally together with source data elements (Dn[0] toDn[3]) from the register Dn. Alternatively, the logic receives sourcedata elements (Qm[0] to Qm[7]) from the register Qm. Each pair ofadjacent source data elements are provided to an associated foldingoperation logic unit 400. Each folding operation logic unit 400 has anarithmetic unit 410 which subtracts one source data element from theother and provides an indication of which was the greater over the path415 to a multiplexer 420. Based upon the indication provided over thepath 415, the multiplexer outputs the greater value source data elementfrom the operation logic unit 400. Hence, it can be seen that eachfolding operation logic unit 400 is arranged to output the maximum ofthe associated adjacent pair of data elements over respective paths 425,435, 445, 455.

Selection and distribution logic 450 receives the resultant dataelements and provides these as required over paths 431 to 434 forstorage in entries of a register Dd in the SIMD register data file 20 insupport of the above-mentioned instructions. The operation of theselection and distribution logic 450 will now be described.

In order to support the instruction illustrated in FIG. 30 a, sourcedata elements Dm[0] to Dm[3] are provided to the lower two foldingoperation logic units 400. The folding operation logic units 400 outputdata elements over the paths 425 and 435. The paths 431 and 432 willprovide Dm[0] op Dm[1] in a sign-extended or zero-extended format,whilst paths 433 and 434 will provide Dm[2] op Dm[3] in a sign-extendedor zero-extended format. This is achieved by signals being generated bythe SIMD decoder 16 in response to the folding instruction which causethe multiplexers 470 to select their B input, the multiplexers 460 toselect either sign-extension or zero-extension, the multiplexers 490 toselect their E input and the multiplexer 480 to select its D input.

In order to support the instruction illustrated in FIG. 30 b, sourcedata elements Dm[0] to Dm[3] are provided to the lower two foldingoperation logic units 400, whilst source data elements Dn[0] to Dn[3]are provided to the tipper two folding operation logic units 400. Thefolding operation logic units 400 output data elements over the paths425, 435, 445 and 455. Path 431 will provide Dm[0] op Dm[1], path 432will provide Dm[2] op Dm[3], path 433 will provide Dn[0] op Dn[1], andpath 434 will provide Dn[2] op Dn[3]. This is achieved by signals beinggenerated by the SIMD decoder 16 in response to the folding instructionwhich cause the multiplexers 470 to select their A input, themultiplexer 480 to select its C input and the multiplexers 490 to selecttheir E input.

In order to support the instruction illustrated in FIG. 30 c, sourcedata elements Qm[0] to Qm[7] are provided to the folding operation logicunits 400. The folding operation logic units 400 output data elementsover the paths 425, 435, 445 and 455. Path 431 will provide Qm[0] opQm[1], path 432 will provide Qm[2] op Qm[3], path 433 will provide Qm[4]op Qm[5], and path 434 will provide Qm[6] op Qm[7]. This is achieved bysignals being generated by the SIMD decoder 16 in response to thefolding instruction which cause the multiplexers 470 to select their Ainput, the multiplexer 480 to select its C input and the multiplexers490 to select their E input.

In order to support the instruction illustrated in FIG. 30 d, sourcedata elements Dm[0] to Dm[3] are provided to the lower two foldingoperation logic units 400. The folding operation logic units 400 outputdata elements over the paths 425 and 435. Path 431 will provide Dm[0] opDm[1], path 432 will provide Dm[2] op Dm[3], path 433 will provide Dm[0]op Dm[1], and path 434 will provide Dm[2] op Dm[3]. This is achieved bysignals being generated by the SIMD decoder 16 in response to thefolding instruction which cause the multiplexers 470 to select their Ainput, the multiplexer 480 to select its D input and the multiplexers490 to select their F input. Alternatively, it will be appreciated thatthe source data elements could have instead also been provided to theupper two folding operation logic units 400 and the same operation asthat illustration to reference to FIG. 30 b could have been performedwhich would reduce the complexity of the selection and distributionlogic 450.

Accordingly, it can be seen that this logic enables a resultant dataelement to be generated from two adjacent source data elements in asingle operation directly from the source data elements.

As mentioned above, the folding operation logic unit 400 may be arrangedto perform any number of operations on the source data elements. Forexample, further logic could readily be provided to selectively enablethe multiplexer 420 to supply the minimum of the source data elementsover the path 425. Alternatively, the arithmetic unit 410 could bearranged to selectively add, subtract, compare or multiply the sourcedata elements and to output the resultant data element. Hence, it willbe appreciated that the approach of the present embodimentadvantageously provides a great deal of flexibility in the range offolding operations that can be performed using this arrangement.

Also, it will be appreciated that whilst the logic described withreference to FIG. 31 supports 16-bit operations, similar logic could beprovided in order to support 32 or 8-bit operations, or indeed any othersizes.

FIG. 32 illustrates the operation of a vector-by-scalar SIMDinstruction. The SIMD instructions follow the same syntax describedelsewhere. It will be appreciated that, as before, where two sourceregisters are indicated, these may be the same register. Also, eachsource register could be specified as the destination register in orderto reduce the amount of register space utilised and to enable efficientrecirculation of data elements.

A register Dm stores a number of data elements D_(m)[0] to D_(m)[3].Each of these data elements represent a selectable scalar operand. Thevector by scalar SIMD instruction specifies one of the data elements asthe scalar operand and performs an operation using that scalar operandin parallel on all the data elements in another register D_(n), theresults of which are stored in a corresponding entry in the registerD_(d). It will be appreciated that the data elements stored in theregisters D_(m), D_(n) and D_(d) could all be of differing sizes. Inparticular, the resultant data elements may be promoted with respect tothe source data elements. Promoting may involve zero padding or signextending to convert from one data type to another. This may have theadditional advantage of guaranteeing that an overflow can not occur.

Being able to select one scalar operand for a SIMD operation isparticular efficient in situations involving matrices of data elements.Different scalar operands can be written to the SIMD register file 20and then readily selected for different vector-by-scalar operationswithout the need to re-write data elements or move data elements around.The following example multiplication instructions support such anoperation:

Mnemonic Data Type Operand Format Description Multiply by Scalar VMUL.I16 Dd, Dn, Dm[x] (Vd[i] = Vn[i] * Vm[x]) .I32 Qd, Qn, Dm[x] .F32.S32.S16 Qd, Dn, Dm[x] .S64.S32 .U32.U16 .U64.U32 Multiply Accumulate byScalar VMLA .I16 Dd, Dn, Dm[x] (Vd[i] = Vd[i] + (Vn[i] * Vm[x])) .I32Qd, Qn, Dm[x] .F32 .S32.S16 Qd, Dn, Dm[x] .S64.S32 .U32.U16 .U64.U32Multiply Subtract by Scalar VMLS .I16 Dd, Dn, Dm[x] (Vd[i] = Vd[i] −(Vn[i] * Vm[x])) .I32 Qd, Qn, Dm[x] .F32 .S32.S16 Qd, Dn, Dm[x] .S64.S32.U32.U16 .U64.U32

Vd, Vn and Vm describe vectors of elements constructed from the chosenregister format and chosen data type. Elements within this vector areselected using the array notation [x]. For example, Vd[0] selects thelowest element in the vector Vd.

An iterator i is used to allow a vector definition; the semantics holdfor all values of i where i is less than the number of elements withinthe vector. The instruction definitions provide ‘Data Type’ and ‘OperandFormat’ columns; a valid instruction is constructed by taking one fromeach column.

FIG. 33 illustrates an arrangement of scalar operands H0 to H31 in theSIMD register file 20. As mentioned elsewhere, the preferred number ofbits used in a field of the instruction to specify the location of adata element in the SIMD register file 20 is 5-bits. This enables 32possible locations to be specified. It will be appreciated that onepossible way to map the scalar operands onto the SIMD register file 20would have been to have placed each operand in the first entry in eachof the registers D₀ to D₃₁. However, the SIMD register file 20 isinstead arranged to map or alias the selectable scalar operands to thefirst 32 logical entries in the SIMD register file 20. Mapping thescalar operands in this way provides significant advantages. Firstly, bylocating the scalar operands in contiguous entries minimises the numberof D registers used to store the scalar operands which in turn maximisesthe number of D registers available to store other data elements. Byhaving the scalar operands stored in contiguous entries enables allscalar operands within a vector to be accessed, which is particularlybeneficial when performing matrix or filter operations. For example, amatrix by vector multiplication requires a vector by scalar operation tobe performed for each scalar chosen from the vector. Furthermore,storing the selectable scalar operands in this way enables, from atleast some of the registers, all the scalar operands to be selected fromthose registers.

FIG. 34 illustrates schematically logic arranged to perform avector-by-scalar operation of an embodiment.

The source data elements (D_(m)[0] to D_(m)[3]) provided from theregister D_(m). Each source data element is provided to scalar selectionlogic 510 which comprises a number of multiplexers 500. Each source dataelement is provided to one input of each multiplexer 500 (i.e. eachmultiplexer receives source data elements D_(m)[0] to D_(m)[3]. Hence,it can be seen that each multiplexer can output any of the source dataelements D_(m)[0] to D_(m)[3]. In this embodiment, each multiplexer isarranged to output the same source data element. Hence, the scalarselection logic 510 can be arranged to select and output one scalaroperand. This is achieved by signals being generated by the SIMD decoder16 in response to the vector-by-scalar instruction which cause themultiplexers to output one of the source data elements D_(m)[0] toD_(m)[3] as the selected scalar operand.

Vector-by-scalar operation logic 520 receives the selected scalaroperand and also receives source data elements D_(n)[0] to D_(n)[3]provided from the register D_(n). Each source data element is providedto the vector-by-scalar operation logic 520 which comprises a number ofoperation units 530. Each source data element is provided to one of theoperation units 530 (i.e. each operation unit receives one of the sourcedata elements D_(m)[0] to D_(m)[3] and the selected scalar operand). Thevector-by-scalar operation logic 520 performs an operation on the twodata elements and outputs a resultant data element for storage inrespective entries of a register in the SIMD register data file 20 insupport of the above-mentioned instructions. This is achieved by signalsbeing generated by the SIMD decoder 16 in response to thevector-by-scalar instruction which cause the operations units 530 toperform the required operation on the received data elements.

Accordingly, it can be seen that this logic enables one of data elementof a source register to be selected as a scalar operand and to performthe vector-by-scalar operations using the same scalar operand on allsource data elements from another register.

FIG. 35 shows a known way of dealing with a shift and narrow operationduring SIMD processing. As can be seen three separate instructions (SHR,SHR and PACK LO) are required to perform this operation. Intermediatevalues are shown with dotted lines for clarity in FIG. 35 and in FIGS.36 and 38.

FIG. 36 shows a shift right and narrow operation according to thepresent technique. The architecture of the present embodiment isparticularly well adapted to process shift and narrow operations and cando so in response to a single instruction. The instruction is decoded byan instruction decoder within SIMD decoder 16 (see FIG. 1). In thisexample the data in register Qn, located in SIMD register file 20 (seeFIG. 1) is shifted right by 5 bits and then the remaining data isrounded and then the 16 right hand side bits are transferred across tothe destination register Dd, also located in SIMD register file 20. Thehardware is able to optionally support rounding and/or saturation of thedata depending on the instruction. Generally shifting right instructionsdo not require saturation as when dealing with integers shifting rightgenerally produces a smaller number. However, when shifting right andnarrowing saturation may be appropriate.

Saturation is a process that can be used to restrict a data element to acertain range by choosing the closest allowable value. For example iftwo unsigned 8-bit integers are multiplied using 8 bit registers, theresult may overflow. In this case the most accurate result that could begiven is binary 11111111, and thus, the number will be saturated to givethis value. A similar problem may arise when shifting and narrowing,whereby a number that is narrowed cannot fit into the narrower space. Inthis case in the case of an unsigned number, when any of the bits thatare discarded in the shift step are not zero then the number issaturated to the maximum allowable value. In the case of a signed numberthe problem is more complicated. In this case the number must besaturated to the maximum allowable positive number or maximum allowablenegative number when the most Significant bit is different from any ofthe discarded bits.

Saturation can also occur where the type of data element input isdifferent to that output, e.g. a signed value may be shifted andnarrowed, saturated and an unsigned value output. The ability to outputdifferent data types can be very useful. For example, in pixelprocessing luminance is an unsigned value, however, during processingthis value it may be appropriate to process it as a signed value.Following processing an unsigned value should be output, however simplyswitching from a signed to an unsigned value could cause problems,unless the ability to saturate the value is provided. For example, ifduring processing due to slight inaccuracies the luminance value hasdropped to a negative number, simply outputting this negative signedvalue as an unsigned value would be a nonsense. Thus, the ability tosaturate any negative number to zero prior to outputting the unsignedvalue is a very useful tool.

Examples of possible formats for different shift instructions are givenbelow in tables 6 and 7. As can be seen the instructions specifies thatit is vector instruction by having a V at the front, a shift is thenspecified with the SH and in the case of shifting with immediates, thedirection right or left is then indicated by an R or L. The instructionthen comprises two types, as in table 0, the first being the size of thedata elements in the destination register and the second being the sizeof the element in the source register. The next information comprisesthe name of the destination register and of the source register and thenan immediate value may be given, this value indicates the number of bitsthat the data is to be shifted and is preceded by a #. Modifiers to thegeneral format of the instruction may be used, a Q is used to indicatethe operation uses saturating integer arithmetic and a R is used toindicate that the operation performs rounding More details of the formatof the instructions are given earlier in the description, for example,in table 0.

Table 7 shows instructions for shifting by signed variables. Thisinstruction is the same as the shifting left by immediates, but insteadof providing an immediate with the instruction a register addressindicating where a vector of signed variable is stored is provided withthe instruction. In this case a negative number indicates a right handshift. As the number of bits to be shifted are stored in a vector, adifferent signed variable can be stored for each data element so thatthey can each be shifted by different amounts. This process is shown inmore detail in FIG. 39.

TABLE 6 Shift by Immediate Immediate shifts use an immediate valueencoded within the instruction to shift all elements of the sourcevector by the same amount. Narrowing versions allow casting down ofvalues, which can include saturation, while Long versions allow castingup with any fixed point. Shift with accumulate versions are provided tosupport efficient scaling and accumulation found in many DSP algorithms.Right shift instructions also provide rounding options. Rounding isperformed by in effect adding a half to the number to be rounded. Thus,when shifting right by n places 2^(n−1) is added to the value prior toshifting it. Thus, in the following table round(n) = 2^(n−1) if n ≧ 1 or0 if n ≦ 0. Bitwise extract instructions are included to allow efficientpacking of data. Mnemonic Data Type Operand Format Description VSHR .S8Dd, Dn, #UIMM Shift Right by Immediate .S16 Dd, Dn, #UIMM Vd[i] :=Vn[i] >> UIMM .S32 .S64 .U8 .U16 .U32 .U64 .S8. s16 Dd, Qn, #UIMM ShiftRight by Immediate and narrow .S16.S32 Vd[i] := Vn[i] >> UIMM .S32.S64.U8.U16 .U16.U32 .U32.U64 VRSHR .S8 Dd, Dn, #UIMM Shift Right byImmediate with rounding .S16 Qd, Qn, #UIMM Vd[i] := (Vn[i] +round(UIMM)) .S32 >> UIMM .S64 .U8 .U16 .U32 .U64 .S8.S16 Dd, Qn, #UIMMShift Right by Immediate .S16.S32 and Narrow with Rounding .S32.S64Vd[i] := (Vn[i] + round .U8.U16 (UIMM)) >> UIMM .U16.U32 .U32.U64 VQSHR.S8.S16 Dd, Qn, #UIMM Saturating Shift Right by Immediate and Narrow.S16.S32 Vd[i] := sat<td>(Vn[i] >> UIMM) .S32.S64 .U8.U16 .U16.U32.U32.U64 .U8.S16 .U16.S32 .U32.S64 VQRSHR .S8.S16 Dd, Qn, #UIMMSaturating Shift Right by .S16.S32 Immediate and Narrow with Rounding.S32.S64 Vd[i] := sat<td>((Vn[i] + .U8.U16 round(UIMM)) >> UIMM).U16.U32 .U32.U64 .U8.S16 .U16.S32 .U32.S64 VSRA .S8 Dd, Dn, #UIMM ShiftRight by Immediate .S16 Qd, Qn, #UIMM and Accumulate .S32 Vd[i] :=Vd[i] + (Vn[i] >> UIMM) .S64 .U8 .U16 .U32 .U64 VQSRA .S8 Dd, Dn, #UIMMSaturating Shift Right by .S16 Qd, Qn, #UIMM Immediate and Accumulate.S32 Vd[i] := sat<td>(Vd[i] + .S64 (Vn[i] >> UIMM)) .U8 .U16 .U32 .U64VRSRA .S8 Dd, Dn, #UIMM Shift Right by Immediate .S16 Qd, Qn, #UIMM andAccumulate with Rounding .S32 Vd[i] := Vd[i] + ((Vn[i] + .S64round(UIMM)) >> UIMM) .U8 .U16 .U32 .U64 VQRSRA .S8 Dd, Dn, #UIMMSaturating Shift Right by Immediate .S16 Qd, Qn, #UIMM and Accumulatewith Rounding .S32 Vd[i] := sat<td> .S64 (Vd[i] + ((Vn[i] + .U8round(UIMM)) >> UIMM)) .U16 .U32 .U64 VSHL .I8 Dd, Dn, #UIMM shift Leftby Immediate .I16 Qd, Qn, #UIMM Vd[i] := Vn[i] << UIMM .I32 .I64 .S16.S8Qd, Dn, #UIMM Shift Left Long by Immediate .S32.S16 Vd[i] := Vn[i] <<UIMM .S64.S32 .U16.U8 .U32.U16 .U64.U32 VQSHL .S8 Dd, Dn, #UIMMSaturating Shift Left .S16 Qd, Qn, #UIMM by Immediate .S32 Vd[i] :=sat<td>(Vn[i] << UIMM) .S64 .U8 .U16 .U32 .U64 .U8.S8 .U16.S16 .U32.S32.U64.S64

TABLE 7 Shift by Signed Variable Shifts in this section perform shiftson one vector of elements controlled by the signed shift amountsspecified in a second vector. Supporting signed shift amounts allowssupport for shifting by exponent values, which may reasonably benegative; a negative control value will perform a shift right. Vectorshifts allow each element to be shifted by a different amount, but canbe used to shift all lanes by the same amount by duplicating the shiftcontrol operand to all lanes of a vector before performing the shift.The signed shift control value is an element is the same size as thesmallest operand element size of the operand to be shifted. However, theshifter variable is interpreted using only the bottom 8-bits of eachlane to determine the shift amount. Rounding and Saturation options arealso available. Mnemonic Data Type Operand Format Description VSHL .S8Dd, Dn, Dm Shift Left by Signed Variable .S16 Qd, Qn, Qm Vd[i] := Vn[i]<< Vm[i] .S32 .S64 .U8 .U16 .U32 .U64 VQSHL .S8 Dd, Dn, Dm SaturatingShift Left .S16 Qd, Qn, Qm by Signed Variable .S32 Vd[i] :=sat<td>(Vn[i] << Vm[i]) .S64 .U8 .U16 .U32 .U64 VRSHL .S8 Dd, Dn, DmRounding Shift Left by Signed Variable .S16 Qd, Qn, Qm Vd[i] := (Vn[i] +round .S32 (−Vm[i])) << Vm[i] .S64 .U8 .U16 .U32 .U64 VQRSHL .S8 Dd, Dn,Dm Saturating Rounding Shift .S16 Qd, Qn, Qm Left by Signed Variable.S32 Vd[i] := sat<td>((Vn[i] + .S64 round(−Vm [i])) << Vm[i]) .U8 .U16.U32 .U64

Thus, as can be seen the hardware supports instructions that are able tospecify both the size of the source data element and resultant dataelement and also sometimes the number of places that the data is to beshifted. This makes it an extremely adaptable and powerful tool.

The shift right and narrow operation shown in FIG. 36 has a number ofpossible applications. For example, in calculations involving fixedpoint numbers where a certain accuracy is required, it may beappropriate to place a say 16-bit number somewhere towards the centre ofa 32-bit data value to reduce the risk of data over or under flow, whilecalculations are performed. At the end of the calculations a 16-bitnumber may be required, and thus a shift and narrow operation as shownin FIG. 36 would be appropriate. The possibility envisaged by thepresent technique of using different sized source and destinationregisters is particularly effective here and allows different sized datato remain in a particular lane during SIMD processing.

A further use of the shift and narrow operation similar to thatillustrated in FIG. 36 could be in the processing of colour pixel data.SIMD processing is particularly appropriate for video data as video datacomprises many pixels that all require the same operation to beperformed upon them. Thus, different pixel data can be in differentlanes in a register and a single instruction can perform the sameoperations on all of the data. Often, video data may come as red greenand blue data. This needs to be separated out before meaningfuloperations can be performed upon it. FIG. 37 shows a typical example ofred green and blue data being present in a 16-bit data element. In theexample shown the blue data could be extracted by a shift left by 3 bitsand narrow operation. The shift left by 3 places sends the blue data tothe right of the middle of the data element, as is shown schematicallyby the dotted line register (representing an intermediate value), threezeros fill in the three empty positions at the right of the data valuecaused by the shift left of the data. The narrow operation results inthe blue data and the three zeros being transferred to the resultant 8bit data element.

In addition to shifting and narrowing the present technique can also beused to cast up and shift, this process is shown in FIG. 38. In thiscase, the casting up is performed followed by a shift left. Thisoperation can be used to for example transfer a 32-bit value to a 64-bitvalue, the 32 bit value being placed in an appropriate position withinthe 64 bit value. In the example shown two 32 bit values are transferredto 64 bit values by being placed at the most significant bits in thelane with zeros being added as least significant bits.

FIG. 39 shows the possibility of using a vector of values indicating thenumber of places each data element should be shifted, the values beingsigned integers, negative numbers indicating a shift right. A registerholding a value for each data element is used and each data element isshifted by the amount specified by the value located in its lane. Theinstructions for such operations are set out previously in table 7.

FIG. 40 schematically shows a simple multiplexing operation. In thismultiplexing operation, multiplexer 700 selects either value a or valueb to be output at D depending on the value of the control bit c. c isused to select the output between a and b. c is often based upon theresult of a decision such as is a>b. Embodiments of the architectureprovide the ability to perform multiplexing operations during SIMDprocessing. SIMD processing is not suitable for performing branchoperations and thus multiplexing can not be performed using standard ifthen else instructions, rather a mask is created, the mask being used toindicate which parts of two source registers a and b are to be selected.

This mask consists of control values that are used to indicate whichparts of two source registers a and b are to be selected. In someembodiments a one in a certain position may indicate that a certainsection of b is to be selected while a zero in that position wouldindicate that a corresponding section of a is to be selected. This maskis stored in a general-purpose register thereby reducing the need forspecial purpose registers.

Generation of the mask is dependent on the multiplexing operation to beperformed and is created in response to this operation. For example inthe case given above a comparison of a and b is performed. This can bedone on a portion by portion basis, for example corresponding dataelements in the SIMD processing are compared. Corresponding dataelements of b and a are compared and a value is written to the portionof the general purpose register that is being used to store the controlvalues depending whether b is greater than a, or b is equal to or lessthan a. This can be done using a compare greater than instruction VCGTon all of the data elements in parallel. This instruction is provided inthe instruction set of embodiments of the system. Table 8 below showssome of the wide range of comparison instructions that are provided byembodiments of the architecture.

TABLE 8 Comparison and Selection Comparison and tests of variables togenerate masks can be performed which can be used to provide data planeselection and masking. It also provides instructions to select themaximum and minimum, including folding versions which can be used at theend of vectorised code to find the maximum or minimum within a vector.Mnemonic Data Type Operand Format Description VCEQ .I8 Dd, Dn, DmCompare Equal .I16 Qd, Qn, Qm Vd[i] := (Vn[i] == Vm[i]) ? .I32 ones :zeros .F32 VCGE .S8 Dd, Dn, Dm Compare Greater-than or Equal .S16 Qd,Qn, Qm Vd[i] := (Vn[i] >= Vm[i]) .S32 ? ones:zeros .U8 .U16 .U32 .F32VCGT .S8 Dd, Dn, Dm Compare Greater-than .S16 Qd, Qn, Qm Vd[i] :=(Vn[i] > Vm[i]) ? .S32 ones : zeros .U8 .U16 .U32 .F32 VCAGE .F32 Dd,Dn, Dm Compare Absolute Greater-than or Equal Qd, Qn, Qm Vd[i] :=(|Vn[i]| >= |Vm[i]|) ? ones : zeros VCAGT .F32 Dd, Dn, Dm CompareAbsolute Greater- than Qd, Qn, Qm Vd[i] := (|Vn[i]| > |Vm[i]|)?ones:zeros VCEQZ .I8 Dd, Dm Compare Equal to Zero .I16 Qd, Qm Vd[i] :=(Vm[i] == 0) .I32 ? ones : zeros .F32 VCGEZ .S8 Dd, Dm CompareGreater-than or Equal to Zero .S16 Qd, Qm Vd[i] := (Vm[i] >= 0) .S32 ?ones : zeros .F32 VCGTZ .S8 Dd, Dm Compare Greater-than Zero .S16 Qd, QmVd[i] := (Vm[i] > 0) ?: .S32 ones : zeros .F32 VCLEZ .F32 Dd, Dm CompareLess-than or Equal to Zero Qd, Qm Vd[i] := (Vm[i] <= 0) ones : zerosNote: Integer a <= 0 == !(a > 0) VCLTZ .F32 Dd, Dm Compare Less-thanZero Qd, Qm Vd[i] := (Vm[i] < 0) ?: ones : zeros Note: Integer a < 0 ==!(a >= 0) VTST .I8 Dd, Dn, Dm Test Bits .I16 Qd, Qn, Qm Vd[i] := ((Vn[i]& Vm[i]) != 0) .I32 ? ones : zeros VMAX .S8 Dd, Dn, Dm Maximum .S16 Qd,Qn, Qm Vd[i] := (Vn[i] >= Vm[i]) ? .S32 Vn[i] : Vm[i] .U8 .U16 .U32 .F32VMIN .S8 Dd, Dn, Dm Minimum .S16 Qd, Qn, Qm Vd[i] := (Vn[i] >= Vm[i]) ?.S32 Vm[i] : Vn[i] .U8 .U16 .U32 .F32

Once the mask has been created a single instruction can be used toselect either a or b using the general-purpose register containing thismask, the control register C. Thus, the data processor is controlled byC to perform the multiplexing operation of selecting either a or b.

FIG. 41 schematically shows an embodiment of the system wherein theselection of source values a or b is done on a bit wise basis. In thiscase the control register 730 has been filled with data by comparingdata elements in registers a 710 and b 720. Thus, data element a0, whichis say eight bits wide is compared with data element b0 having the samesize. In this case a is less than or equal to b and thus eight zeros areinserted into the corresponding portion of the control register 730. Ifa is greater than b8 ones are inserted into the corresponding portion ofthe control register 730. A similar comparison is performed in parallelfor all the data elements and corresponding control bits produced. Thecomparison operation that generates the control vector corresponds tothe instruction VCGT.S8 c,a,b. Selection can then be performed verysimply on a bit by bit basis by performing simple logical operationsbetween the bits store in the source registers and the correspondingbits stored in the control register, each resultant bit being written toa destination register, which in this example is register 730, i.e. theresults overwrite the control values. The advantage of this bitwiseselection is that it is independent of data type and width and ifappropriate different sized data elements can be compared.

FIG. 42 shows an alternative embodiment where the control is not done ona bit-wise basis but is done on a data element basis. In the embodimentshown if a data element in the control register C 730, is greater thanor equal to zero then a corresponding data element in source register b720, it is written to the destination register (in this case register720). If, as in this example, C is a signed integer, then only the mostsignificant bit of C needs to be considered when deciding which of a orb to select.

In other embodiments other properties of C can be used to determinewhether a data element from register a, 710 is to be selected, or onefrom data register b, 720. Examples of such properties include, whetherC is odd or even, where again only one bit of the control value need tobe considered, in this case the least significant bit, or if C is equalto zero, not equal to zero or greater than zero.

Generally ARM instructions and in fact many other RISC instructions onlyprovide three operands with any instruction. Multiplexing operations ingeneral require four operands to specify two source registers a and b, acontrol register C and a destination register D. Embodiments of thepresent system take advantage of the fact that generally following amultiplexing operation, at least one of the two sets of source data orthe control data is no longer required. Thus, the destination registeris chosen to be either one of the two source registers or the controlregister. This only works as the control register is a general-purposeregister and not a special register. In embodiments of the system, threedifferent instructions are provided in the instruction set, aninstruction specific to writing back to one source register, anotherinstruction for writing back to the other source register and a thirdinstruction for writing to the control register. Each instructionrequires just three operands, specifying two source registers and acontrol register. These three instructions are specified in table 9below.

TABLE 9 Logical and Bitwise selection Mnemonic Data Type Operand FormatDescription VBIT none Dd, Dn, Dm Bitwise Insert if True Qd, Qn, Qm Vd :=(Vm) ? Vn : Vd VBIF none Dd, Dn, Dm Bitwise Insert if False Qd, Qn, QmVd := (Vm) ? Vd : Vn VBSL none Dd, Dn, Dm Bitwise Select Qd, Qn, Qm Vd:= (Vd) ? Vn : Vm

FIG. 43 schematically shows three examples of multiplexer arrangementscorresponding to the three multiplexing instructions provided by thesystem. FIG. 43 a shows multiplexer 701 wired to perform the instructionbitwise select VBSL. In this example, contrary to the exampleillustrated in FIGS. 41 and 42, A is selected when C is false (0), and Bis selected when C is true (1). In the embodiment illustrated thedestination register is the same as the control register so that theresultant values overwrite the control values. If the reverse selectionwas required, i.e. A is selected when C is true and B when C is false,the same circuit could be used by simply swapping the operands A and B.

FIG. 43 b shows a multiplexer 702 corresponding to the instruction BITbitwise insert if true, and results in source register A acting as bothsource and destination register and being overwritten with the resultdata. In this example B is written into A when C is true, while if C isfalse the value present in register A remains unchanged. In thisembodiment if the reverse selection is required, i.e. it is desired towrite B to the destination register if C is false rather than true it isnot possible to simply switch the registers around as the device doesnot have the symmetry of multiplexer 701.

FIG. 43 c shows a multiplexer 703 that is set up to correspond to thereverse selection of FIG. 43 b, i.e. the instruction BIF bitwise insertif false. In this embodiment the value in register A is written intoregister B when C is false, while when C is true the value in register Bremains unchanged. As in FIG. 43 b there is no symmetry in this system.

FIG. 44 schematically illustrates a sequence of bytes of data B₀ to B₇stored within a memory. These bytes are stored in accordance with byteinvariant addressing whereby the same byte of data will be returned inresponse to reading of a given memory address irrespective of thecurrent endianess mode. The memory also supports unaligned addressingwhereby half words, words or larger multi-byte data elements may be readfrom the memory starting at an arbitrary memory-byte address.

When the eight bytes of data B₀ to B₇ are read from the memory with thesystem in little endian mode, then the bytes B₀ to B₇ are laid outwithin a register 800 in the order shown in FIG. 44. The register 800contains four data elements each comprising a half word of sixteen bits.FIG. 44 also shows the same eight bytes of data B₀ to B₇ being read outinto a register 802 when the system is operating in big endian mode.

In this example, the data once read out from memory into the respectiveSIMD register 800, 802 is subject to a squaring operation which resultsin a doubling of the data element size. Accordingly, the result iswritten in two destination SIMD registers 804, 806. As will be seen fromFIG. 44, the result values written respectively in the first or secondof these register pairs 804, 806 vary depending upon the endianess modein which the data has been read from the memory. Accordingly, a SIMDcomputer program which is to further manipulate the squared resultvalues may need to be altered to take account of the different layout ofthe data depending upon the endianess mode. This disadvantageouslyresults in the need to produce two different forms of the computerprogram to cope with different endianess in the way that the data hasbeen stored within the memory.

FIG. 45 addresses this problem by the provision of reordering logic 808.The data processing system includes memory accessing logic 810 whichserves to read the eight bytes of data B₀ to B₇ from the memory startingat a specified memory address and utilising the byte invariantaddressing characteristic of the memory. The output of the memoryaccessing logic 810 accordingly presents bytes read from a given memoryaddress at the same output lane irrespective of the endianess mode.Thus, in the example illustrated in which the data elements are halfwords, a byte recovered from a particular memory address may be the mostsignificant portion of a half word when in one endianess mode whilst itis the least significant portion of a half word in the other endianessmode.

The data element reordering logic 808 is responsible for reordering thedata elements retrieved from the memory by the memory access logic 810such that the data elements which are loaded into the SIMD register 812will be in a form consistent with the data having been stored in alittle endian form and loaded without rearrangement irrespective of theendianess mode being used within the memory system. In the case of alittle endian mode being used within the memory system, the data elementreordering logic 808 will not reorder the bytes and will pass thesethrough unaltered. However, in the case of the data being stored in abig endian form within the memory system, the data element reorderinglogic 808 serves to reverse the order of the bytes read from the memorywithin each half word so that the half word data element will appear inlittle endian form within the SIMD register 812. In this way, a singleSIMD computer program can perform the correct data processing operationsupon the data elements transferred into the SIMD register irrespectiveof the endianess mode in which these were stored within the memory. Itwill be seen from FIG. 45 that the data element reordering logic 808 isresponsive to a signal indicating the endianess mode being used by thememory and a signal indicating the size of the data elements concerned.The endianess mode being used will control whether or not any reorderingis required and the size will control the nature of the reorderingapplied if it is required. It will be seen that when the data is storedwithin the memory in little endian mode and the SIMD registers arelittle endian, then no reordering is required. Conversely, if the SIMDregisters assumed a big endian form then no reordering would be requiredwhen the data was stored in big endian form within the memory butreordering would be required when the data was stored within a littleendian form within the memory.

FIG. 46 illustrates an example similar to that of FIG. 45 except that inthis example the data elements are 32-bit data words. As will be seen,when these data words are stored within the memory in a big endian form,the reordering applied by the data element reordering logic 808 reversesthe byte order of four byte data elements as retrieved by the memoryaccessing logic 810 so that these are stored into the SIMD register 812in a form consistent with the data having been stored in a little endianform in the memory and loaded without rearrangement.

It will be appreciated that in the context of the processor system as awhole described herein, the memory accessing logic 810 and the dataelement reordering element 808 may form part of the previously describedload store unit. The data element reordering logic 808 may also be usedto compensate for memory system endianess when reading data into thescalar registers when a particular endianess is being assumed for thedata within the scalar registers.

FIG. 47 illustrates the data element reordering logic 808 in moredetail. It will be seen that this is formed as three levels ofmultiplexers controlled by respective controlled signals Z, Y and X.These three layers are respectively responsible for reversing positionsof adjacent bytes, adjacent half words and adjacent words of data. Thecontrol signals X, Y and Z are decoded from an endianess signal whichwhen asserted indicates big endian mode and a size signal indicatingrespectively 64, 32 or 16 bit data element size as is illustrated inFIG. 47. It will be appreciated that many other forms of data elementreordering logic could be used to achieve the same functional result asis illustrated in FIGS. 45 and 46.

The memory access instruction which is used to perform the byteinvariant addressing of the memory conveniently uses a memory addresspointer which is held within a register of a scalar register bank of theprocessor. The processor supports data processing instructions whichchange the data element size as well as data processing instructionswhich operate on selected ones of data elements within a SIMD register.

FIG. 48 illustrates a register data store 900 which includes a list ofregisters D0, D1 each serving as a table register, an index register D7and a result register D5. It will be seen that the table registers D0,D1 are contiguously numbered registers within the register data store900. The result register D7 and the index register D5 are arbitrarilypositioned relative to the table registers and each other. The syntax ofthe instruction corresponding to this data manipulation is shown in thefigure.

FIG. 49 schematically illustrates the action of a table lookup extensioninstruction. This instruction specifies a list of registers to be usedas a block of table registers, such as by specifying the first registerin the list and the number of registers in the list (e.g. one to four).The instruction also specifies a register to be used as the indexregister D7 and a register to be used as the result register D5. Thetable lookup extension instruction further specifies the data elementssize of the data elements stored within the table registers D0, D1 andto be selected and written into the result register D5. In the exampleillustrated, the table registers D0, D1 each contain eight dataelements. Accordingly, the index values have an in-range span of 0 to15. Index values outside of this predetermined range will not result ina table lookup and instead the corresponding position within the resultregister D5 will be left unchanged. As illustrated, the fourth and sixthindex values are out-of-range in this way. The other index values pointto respective data elements within the table registers D0, D1 and thesedata elements are then stored into the corresponding positions withinthe result register D5. There is a one-to-one correspondence betweenindex value position within the index register D7 and data elementposition within the result register D5. The values marked “U” in theresult register D5 indicate that the values stored at those locationsare preserved during the action of the table lookup extensioninstruction. Thus, whatever bits were stored in those locations prior toexecution of the instruction are still stored within those positionsfollowing the execution of the instruction.

FIG. 50 illustrates the index values from FIG. 49 which are then subjectto a SIMD subtraction operation whereby an offset of sixteen is appliedto each of the index values. This takes the previously in-range indexvalues to out-of-range values. The previously out-of-range values arenow moved in-range. Thus, when the index register D7 containing the nowmodified index values is reused in another table lookup extensioninstruction, the fourth and sixth index values are now in-range andresult in table lookups being performed in table registers D0, D1 (orother different registers which may be specified in the second tablelookup extension instruction) which have also been reloaded prior to theexecution of a second table lookup extension instruction. Thus, a singleset of index values within an index register D7 may be subject to anoffset and then reused with reloaded table registers D0, D1 to give theeffect of a larger table being available.

FIG. 51 illustrates further a table lookup instruction which may beprovided in addition to the table lookup extension instruction. Thedifference between these instructions is that when an out-of-range indexvalue is encountered in a table lookup instruction, the location withinthe result register D5 corresponding to that index value is written towith zero values rather than being left unchanged. This type ofbehaviour is useful in certain programming situations. The example FIG.51 illustrates three table registers rather than two table registers.The first, third, fourth, sixth and seventh index values areout-of-range. The second, fifth and eighth index values are in-range andresult in table lookups of corresponding data elements within the tableregisters.

As mentioned earlier, load and store instructions are provided formoving data between the SIMD register file 20 (see FIG. 1) and memory.Each such load and store instruction will specify a start addressidentifying the location within the memory from which the accessoperation (whether that be a load operation or a store operation) shouldbegin. In accordance with the load and store instructions ofembodiments, the amount of data that is the subject of that load orstore instruction can be varied on a per instruction basis. Inparticular embodiments, the amount of data is identified by identifyingthe data type “dt” (i.e. the size of each data element) and identifyingthe number of data elements to be accessed by identifying the SIMDregister list and optionally the number of structures to be accessed.

When performing SIMD processing, it is often the case that the accessoperations performed with respect to the necessary data elements areoften unaligned accesses (also referred to herein as byte alignedaccesses). In other words, the start address will often be unaligned,and in such situations the LSU 22 needs to allocate to the accessoperation the maximum number of accesses that may be required to enablethe access operation to complete.

Whilst in a possible implementation, the LSU 22 could be arranged toassume that every access is unaligned; this means that the LSU 22 isunable to improve the efficiency of the access operations in situationswhere the start address is in fact aligned with a certain multiplenumber of bytes.

Whilst the LSU 22 would be able to determine from the start addresswhether the start address has a predetermined alignment, the LSU 22typically has to commit the number of accesses for the access operationat a time before the start address has actually been computed. In aparticular embodiment, the LSU 22 has a pipelined architecture, and thenumber of accesses to be used to perform any particular access operationis determined by the LSU in the decode stage of the pipeline. However,often the start address is computed in a subsequent execute stage of thepipeline, for example by adding an offset value to a base address, andaccordingly the LSU 22 is unable to await determination of the startaddress before determining how many accesses to allocate to the accessoperation.

In accordance with an embodiment, this problem is alleviated byproviding an alignment specifier field within the access instruction,also referred to herein as an alignment qualifier. In one particularembodiment, the alignment qualifier can take a first value whichindicates that the start address is to be treated as byte aligned, i.e.unaligned. It will be appreciated that this first value could beprovided by any predetermined encoding of the alignment specifier field.In addition, the alignment qualifier can take any one of a plurality ofsecond values indicating different predetermined alignments that thestart address is to be treated as conforming to, and in one particularembodiment, the plurality of available second values are as indicated inthe following table:

TABLE 10 Alignment Start Address Qualifier Format Promise andAvailability @16 . . . xxxxxxx0 The start address is to be considered tobe a multiple of 2 bytes. Available to instructions that transferexactly 2 bytes. @32 . . . xxxxxx00 The start address is to beconsidered to be a multiple of 4 bytes. Available to instructions thattransfer exactly 4 bytes. @64 . . . xxxxx000 The start address is to beconsidered to be a multiple of 8 bytes. Available to instructions thattransfer a multiple of 8 bytes. @128 . . . xxxx0000 The start address isto be considered to be a multiple of 16 bytes. Available to instructionsthat transfer a multiple of 16 bytes. @256 . . . xxx00000 The startaddress is to be considered to be a multiple of 32 bytes. Available toinstructions that transfer a multiple of 32 bytes.

The manner in which this alignment specifier information is used in oneembodiment will now be described with reference to FIG. 52. As shown inFIG. 52, the LSU 22 will typically be connected to a memory system via adata bus of a predetermined width. Often the memory system will consistof a number of different levels of memory, and the first level of memoryis often a cache, this being the level of memory with which the LSUcommunicates via the data bus. Accordingly, as shown in FIG. 52, the LSU22 is arranged to communicate with a level 1 cache 1010 of the memoryvia a data bus 1020, in this particular example the data bus beingconsidered to have a width of 64 bits. In the event of a cache hit theaccess takes place with respect of the contents of the level 1 cache,whereas in the event of a cache miss, the level 1 cache 1010 will thencommunicate with other parts of the memory system 1000 via one or morefurther buses 1030.

The various parts of the memory system may be distributed, and in theexample illustrated in FIG. 52, it is assumed that the level 1 cache1010 is provided on-chip, i.e. is incorporated within the integratedcircuit 2 of FIG. 1, whilst the rest of the memory system 1000 isprovided off-chip. The delimitation between on-chip and off-chip isindicated by the dotted line 1035 in FIG. 52. However, it will beappreciated by those skilled in the art that other configurations may beused, and so for example all of the memory system may be providedoff-chip, or some other delimitation between the on-chip parts of thememory system and the off-chip parts of the memory system may beprovided.

The LSU 22 is also arranged to communicate with a memory management unit(MMU) 1005, which typically incorporates a Translation Lookaside Buffer(TLB) 1015. As will be appreciated by those skilled in the art, an MMUis used to perform certain access control functions, for exampleconversion of virtual to physical addresses, determination of accesspermissions (i.e. whether the access can take place), etc. To do this,the MMU stores within the TLB 1015 descriptors obtained from page tablesin memory. Each descriptor defines for a corresponding page of memorythe necessary access control information relevant to that page ofmemory.

The LSU 22 is arranged to communicate certain details of the access toboth the level 1 cache 1010 and the MMU 1005 via a control path 1025. Inparticular, the LSU 22 is arranged to output to the level 1 cache andthe MMU a start address and an indication of the size of the block ofdata to be accessed. Furthermore, in accordance with one embodiment, theLSU 22 also outputs alignment information derived from the alignmentspecifier. The manner in which the alignment specifier information isused by the LSU 22 and/or by the level 1 cache 1010 and the MMU 1005will now be described further with reference to FIGS. 53A to 54B.

FIG. 53A illustrates a memory address space, with each solid horizontalline indicating a 64-bit alignment in memory. If the access operationspecifies the 128-bit long data block 1040, which for the sake ofargument we will assume has a start address of 0x4, then the LSU 22needs to determine the number of separate accesses over the 64-bit databus 1020 to allocate to the access operation. Further, as discussedearlier, it will typically need to make this determination before itknows what the start address is. In the embodiment envisaged withrespect to FIG. 52, the LSU 22 is arranged to use the alignmentspecifier information when determining the number of accesses toallocate.

In the example of FIG. 53A, the start address is 32-bit aligned, and thealignment specifier may have identified this alignment. In thatinstance, as can be seen from FIG. 53A, the LSU 22 has to assume theworst case scenario, and hence assume that three separate accesses willbe required in order to perform the necessary access operation withregard to the data block 1040. This is the same number of accesses thatwould have to be allocated for an unaligned access.

However, if we now consider the similar example illustrated in FIG. 53B,it can be seen that again a 128-bit data block 1045 is to be accessed,but in this instance the start address is 64-bit aligned. If thealignment specifier information identifies this 64-bit alignment, orindeed identifies the data as being 128-bit aligned, then in this casethe LSU 22 only needs to allocate two separate accesses to the accessoperation, thereby providing a significant improvement in efficiency.If, however, the data bus were 128-bits wide, then if the alignmentspecifier indicated 128-bit alignment rather than 64-bit alignment, theLSU 22 would only need to allocate a single access.

Considering now the example in FIG. 53C, here it can be seen that a96-bit size data block 1050 needs to be accessed, and in this instanceit is assumed that the alignment specifier identifies that the startaddress is 32-bit aligned. Again, in this example, even though the LSU22 will not actually have calculated the start address at the time thenumber of accesses needs to be committed, the LSU 22 can still assumethat only two accesses need to be allocated to the access operation.FIG. 53D illustrates a fourth example in which an 80-bit data block 1055is to be accessed, and in which the alignment specifier identifies thatthe start address is 16-bit aligned. Again, the LSU 22 only needs toallocate two accesses to the access operation. If instead the alignmentspecifier had indicated that the access was to be treated as anunaligned access, then it is clear that the LSU would have to haveallocated three accesses to the access operation, as indeed would havebeen the case for the access illustrated in FIG. 53C. Accordingly, itcan be seen that the alignment specifier information can be used by theLSU 22 to significantly improve the performance of accesses insituations where the alignment specifier indicates a certainpredetermined alignment of the start address.

It should be noted that the alignment specifier cannot be taken as aguarantee that the start address (also referred to herein as theeffective address) will have that alignment, but does provide the LSU 22with an assumption on which to proceed. If the start addresssubsequently turns out not to obey the alignment specified by thealignment specifier, then in one embodiment the associated load or storeoperation is arranged to generate an alignment fault. The alignmentfault can then be handled using any one of a number of known techniques.

As mentioned earlier, the alignment information is not only used by theLSU 22, but is also propagated via path 1025 to both the level 1 cache100 and the MMU 1005. The manner in which this information may be usedby the level 1 cache or the MMU will now be described with reference toFIGS. 54A and 54B. As illustrated in FIGS. 54A and 54B, an access to a256-bit data block 1060, 1065 is considered, in these examples the solidhorizontal lines in the diagrams indicating a 128-bit alignment inmemory. In FIG. 54A, it is assumed that the data block is 64-bitaligned, whilst in FIG. 54B it is assumed that the data block is 128-bitaligned. In both instances, since the data bus 1020 is only 64-bitswide, it will be clear that the LSU 22 has to allocate four accesses tothe access operation. From the LSU's perspective, it does not matterwhether the alignment specifier specifies that the start address is64-bit aligned or 128-bit aligned.

However, the cache lines within the level 1 cache 1010 may each becapable of storing in excess of 256 bits of data, and further may be128-bit aligned. In the example of FIG. 54A, since the data block is not128-bit aligned, the cache will need to assume that two cache lines willneed to be accessed. However, in the example of FIG. 54B, the level 1cache 1010 can determine from the alignment specifier that only a singlecache line within the level 1 cache needs to be accessed, and this canbe used to increase the efficiency of the access operation within thelevel 1 cache 1010.

Similarly, the page tables that need to be accessed by the MMU in orderto retrieve the appropriate descriptors into the TLB 1015 will oftenstore in excess of 256 bits of data, and may often be 128-bit aligned.Accordingly, the MMU 1005 can use the alignment information providedover path 1025 in order to determine the number of page tables to beaccessed. Whilst in the example of FIG. 54A, the MMU 1005 may need toassume that more than one page table will need to be accessed, in theexample of FIG. 54B, the MMU can determine from the alignment specifierthat only a single page table needs to be accessed, and this informationcan be used to improve the efficiency of the access control functionsperformed by the MMU 1005.

Accordingly, it can be seen that the use of the alignment specifierwithin the load or store instructions as described above can be used toenable the hardware to optimise certain aspects of the access operation,which is especially useful if the number of access cycles and/or cacheaccesses has to be committed to before the start address can bedetermined. This scheme is useful for load or store instructionsspecifying various lengths of data to be accessed, and on processorswith differing data bus sizes between the LSU and the memory system.

There are a number of data processing operations which do not lendthemselves to being performed in a standard SIMD format, where multipledata elements are placed side-by-side within a register, and then theoperation is performed in parallel on those data elements. Examples ofsome such operations are illustrated in FIGS. 55A to 55C. FIG. 55Aillustrates an interleave operation, where it is desired to interleavefour data elements A, B, C, D within a first register 1100 with fourdata elements E, F, G, H within a second register 1102. In FIG. 55A, theresultant interleave data elements are shown within destinationregisters 1104, 1106. These destination registers may be differentregisters to the source registers 1100, 1102, or alternatively may bethe same set of two registers as the source registers. As can be seenfrom FIG. 55A, in accordance with this interleave operation, the firstdata elements from each source register are placed side-by-side withinthe destination registers, followed by the second data elements fromboth source registers, followed by the third data elements from bothsource registers, followed by the fourth data elements from both sourceregisters.

FIG. 55B illustrates the reverse de-interleave operation, where it isrequired to de-interleave the eight data elements placed in the twosource registers 1108 and 1110. In accordance with this operation, thefirst, third, fifth and seventh data elements are placed in onedestination register 1112, whilst the second, fourth, sixth and eighthdata elements are placed in a second destination register 1114. As withthe FIG. 55A example, it will be appreciated that the destinationregisters may be different to the source registers, or alternatively maybe the same registers. If in the examples of FIGS. 55A and 55B it isassumed that the registers are 64-bit registers, then in this particularexample the data elements being interleaved or de-interleaved are 16-bitwide data elements. However, it will be appreciated that there is norequirement for the data elements being interleaved or de-interleaved tobe 16-bits wide, nor for the source and destination registers to be64-bit registers.

FIG. 55C illustrates the function performed by a transpose operation. Inaccordance with this example, two data elements A, B from a first sourceregister 1116, and two data elements C, D from a second source register1118, are to be transposed, and the result of the transposition is thatthe second data element from the first source register 1116 is swappedwith the first data element from the second source register 1118, suchthat within the first destination register 1120, the data elements A, Care provided, whilst in a second destination register 1122 the dataelements B, D are provided. Again, the destination registers may bedifferent to the source registers, but it is often the case that thedestination registers are in fact the same registers as the sourceregisters. In one example, each of the registers 1116, 1118, 1120, 1122may be considered to be 64-bit registers, in which event the dataelements are 32-bit wide data elements. However, there is no requirementfor the data elements to be 32-bit wide, nor for the registers to be64-bit registers.

Further, whilst in all of the above examples it has been assumed thatthe entire contents of the registers are shown, it is envisaged that anyof these three discussed operations could be performed independently onthe data elements within different portions of the relevant sourceregisters, and hence the figures in that case illustrate only a portionof the source/destination registers.

As mentioned earlier, the standard SIMD approach involves placingmultiple data elements side-by-side within a register, and thenperforming an operation in parallel on those data elements. In otherwords, the parallelisation of the operation is performed at the dataelement granularity. Whilst this leads to very efficient execution ofoperations where the required data elements can be arranged in such amanner, for example by spreading the required source data elementsacross multiple registers, there are a significant number of operationswhere it is not practical to arrange the required source data elementsin such a way, and hence in which the potential speed benefits of a SIMDapproach have not previously been able to be exploited. The aboveinterleave, de-interleave and transpose operations are examples of suchoperations which have not previously been able to take advantage of thespeed benefits of a SIMD approach, but it will be appreciated that thereare also many other examples, for example certain types of arithmeticoperations. One particular example of such an arithmetic operation is anarithmetic operation which needs to be applied to a complex numberconsisting of real and imaginary parts.

In accordance with one embodiment, this problem is alleviated byproviding the ability for certain data processing instructions toidentify not only a data element size, but also to further identify as aseparate entity a lane size, the lane size being a multiple of the dataelement size. The parallelisation of the data processing operation thenoccurs at the granularity of the lane size rather than the data elementsize, such that more than one data element involved in a particularinstantiation of the data processing operation can co-exist within thesame source register. Hence, the processing logic used to perform thedata processing operation can define based on the lane size a number oflanes of parallel processing, and the data processing operation can thenbe performed in parallel in each of the lanes, the data processingoperation being applied to selected data elements within each such laneof parallel processing.

By such an approach, it is possible to perform in a SIMD mannerinterleave operations such as those described earlier with reference toFIG. 55A. In particular, FIG. 56A illustrates the processing performedwhen executing a “ZIP” instruction in accordance with one embodiment. Inthis particular example, the ZIP instruction is a 32|ZIP.8 instruction.This instruction hence identifies that the data elements are 8-bitswide, and the lanes are 32-bits wide. For the example of FIG. 56A, it isassumed that the ZIP instruction has specified the source registers tobe the 64-bit registers D0 1125 and D1 1130. Each of these registershence contains eight 8-bit data elements. Within each lane theinterleave operation is applied independently, and in parallel,resulting in the rearrangement of data elements as shown in the lowerhalf of FIG. 56A. In one embodiment, it is assumed that for the ZIPinstruction, the destination registers are the same as the sourceregisters, and accordingly these rearranged data elements are once againstored within the registers D0 1125 and D1 1130. As can be seen fromFIG. 56A, within lane 1, the first four data elements of each sourceregister have been interleaved, and within lane 2, the second four dataelements of each source register have been interleaved.

It will be readily appreciated that different forms of interleavingcould be performed by changing either the lane size, or the data elementsize. For example, if the lane size was identified as being 64-bits,i.e. resulting in there being only a single lane, then it can be seenthat the destination register D0 would contain the interleaved result ofthe first four data elements of each register, whilst the destinationregister D1 would contain the interleaved result of the second four dataelements of each register. It will be appreciated that a correspondingUNZIP instruction can be provided in order to perform the correspondingde-interleave operation, the UNZIP instruction again being able tospecify both a lane size and a data element size.

Typically, a transpose operation is considered to be a quite differentoperation to an interleave operation or a de-interleave operation, andhence it would typically be envisaged that a separate instruction wouldneed to be provided to perform transpose operations. However, it hasbeen realised that when providing an interleave or a de-interleaveinstruction with the ability to separately define a lane size and a dataelement size, then the same instruction can in fact be used to perform atranspose operation when two source registers are specified, and thelane size is set to be twice the data element size. This is illustratedin FIG. 56B where the interleave instruction ZIP has been set toidentify a data element size of 8 bits, and a lane size of 16 bits (i.e.twice the data element size). Assuming the same 64-bit source registersD1 1125 and D1 1130 are chosen as in the FIG. 56A example, this definesfour lanes of parallel processing as shown in FIG. 56B. As can then beseen from the lower half of FIG. 56B, the interleaving process actuallyresults within each lane in the generation of a transposed result, inthat the first data element of the second source register within eachlane is swapped with the second data element of the first sourceregister within each lane.

Hence, in accordance with the above described embodiment, the same ZIPinstruction can be used to perform either an interleave, or a transposeoperation, dependent on how the lane size and data element size aredefined. It should further be noted that a transposition can also beperformed in exactly the same manner using the UNZIP instruction, andaccordingly a 16|UNZIP.8 instruction will perform exactly the sametranspose operation as a 16|ZIP.8 instruction.

FIGS. 57A to 57C illustrate one particular example of an implementationof such ZIP instructions, in which a four-by-four array of pixels 1135within an image are to be transposed about the line 1136 (see FIG. 57A).Each pixel will typically consist of red, green and blue componentsexpressed in RGB format. If for the sake of argument we assume that thedata required to define each pixel is 16-bits in length, then it can beseen that the data for each horizontal line of four pixels in the array1135 can be placed in a separate source register A, B, C, D.

FIG. 57B illustrates the various transpositions that occur if thefollowing two instructions are executed:

-   32|ZIP.16 A, B-   32|ZIP.16 C, D

Each ZIP instruction hence defines the lane width to be 32-bits, and thedata element width to be 16-bits, and thus within each lane the firstdata element in the second register is swapped with the second dataelement in the first register, as shown by the four diagonal arrowedlines illustrated in FIG. 57B. Hence, separate transpositions occurwithin each of the four two-by-two blocks 1137, 1141, 1143 and 1145.

FIG. 57C then illustrates the transposition that occurs as a result ofexecution of the following two instructions:

-   64|ZIP.32 A, C-   64|ZIP.32 B, D

In accordance with these instructions, the lane width is set to be64-bits, i.e. the entire width of the source registers, and the dataelement width is chosen to be 32-bits. Execution of the first ZIPinstruction thus results in the second 32-bit wide data element inregister A 1147 being swapped with the first 32-bit wide data elementwithin the register C 1151. Similarly, the second ZIP instructionresults in the second 32-bit wide data element in the register B 1149being swapped with the first 32-bit data element within the register D1153. As illustrated by the diagonal arrowed line in FIG. 57C, thishence results in the two-by-two block of pixels in the top left beingswapped by the two-by-two block of pixels in the bottom right. As willbe appreciated by those skilled in the art, this sequence of four ZIPinstructions has hence transposed the entire four-by-four array 1135 ofpixels about the diagonal line 1136. FIG. 58 illustrates one particularexample of the use of the interleave instruction. In this example,complex numbers consisting of real and imaginary parts are considered.It may be the case that a certain computation needs to be performed onthe real parts of a series of complex numbers, whilst a separatecomputation needs to be performed on the imaginary part of those complexnumbers. As a result, the real parts may have been arranged in aparticular register D0 1155 whilst the imaginary parts may have beenplaced in a separate register D1 1160. At some point, it may be desiredto reunite the real and imaginary parts of each complex number so thatthey are adjacent to each other within the registers. As is illustratedin FIG. 58, this can be achieved through the use of a 64|ZIP.16instruction which sets the lane width to be the full width of the sourceregisters, and sets the data element width to be 16-bits, i.e. the widthof each of the real and imaginary parts. As shown by the lower half ofFIG. 58, the result of the execution of the ZIP instruction is that eachof the real and imaginary parts of each complex number a, b, c, d arereunited within the register space, the destination register D0 1155containing the real and imaginary parts of the complex numbers a and band the destination register D1 1160 containing the real and imaginaryparts of the complex numbers c and d.

It is not just data rearranging instructions like interleave andde-interleave instructions that can take advantage of the ability tospecify the lane size independently of the data element size. Forexample, FIGS. 59A and 59B illustrate a sequence of two instructionsthat can be used to perform a multiplication of two complex numbers. Inparticular, it is desired to multiply a complex number A by a complexnumber B, in order to generate a resultant complex number D, asillustrated by the following equation:D _(re) =A _(re) *B _(re) −A _(im) *B _(im)D _(im) =A _(re) *B _(im) +A _(im) *B _(re)

FIG. 59A shows the operation performed in response to a first multiplyinstruction of the following form:

32|MUL.16 Dd, Dn, Dm[0]

The source registers are 64-bit registers, and the multiply instructionspecifies a lane width of 32 bits and a data element size of 16 bits.The multiply instruction is arranged within each lane to multiply thefirst data element in that lane within the source register Dm 1165 witheach of the data elements in that lane in the second source register Dn1170 (as shown in FIG. 59A), with the resultant values being stored incorresponding locations within the destination register Dd 1175. Withineach lane, the first data element in the destination register isconsidered to represent the real part of the partial result of thecomplex number, and the second data element is considered to representthe imaginary part of the partial result of the complex number.

Following execution of the instruction illustrated in FIG. 59A, thefollowing instruction is then executed:

32|MASX.16 Dd, Dn, Dm[1]

As illustrated by FIG. 59B, this instruction is a “multiply add subtractwith exchange” instruction. In accordance with this instruction, thesecond data element within each lane of the source register Dm ismultiplied with each data element within the corresponding lane of thesecond source register Dn, in the manner illustrated in FIG. 59B. Then,the result of that multiplication is either added to, or subtractedfrom, the values of corresponding data elements already stored withinthe destination register Dd 1175, with the result then being placed backwithin the destination register Dd 1175. It will be appreciated from acomparison of the operations of FIGS. 59A and 59B with the earlieridentified equations for generating the real and imaginary parts of theresultant complex number D that by employing these two instructions insequence, the computation can be performed in parallel for two sets ofcomplex numbers, thereby enabling the speed benefit of a SIMD approachto be realised.

From the above examples, it will be appreciated that by providing aninstruction with the ability to specify a lane size in addition to adata element size, the number of operations that can potentially benefitfrom a SIMD implementation is increased, and hence this provides a muchimproved flexibility with regard to the implementation of operations ina SIMD manner.

The present technique provides the ability to perform SIMD processing onvectors where the source and destination data element widths aredifferent. One particularly useful operation in this environment is anadd or subtract then return high half SIMD operation. FIG. 60 shows anexample of an add return high half operation according to the presenttechnique. An instruction decoder within the SIMD decoder 16 (seeFIG. 1) decodes instruction VADH.I16.I32 Dd,Qn,Qm and performs theaddition return high half illustrated in FIG. 60 and set out below.

In FIG. 60 two source registers located in the SIMD register file 20(see FIG. 1), Qn and Qm contain vectors of 32-bit data elements a and b.These are added together to form a vector of 16-bit data elements Ddalso located in register file 20 formed from the high half of the datasums:Qn=[a3 a2 a1 a0]Qm=[b3 b2 b1 b]OutputDd=[(a3+b3)>>16, (a2+b2)>>16, (a1+b1)>>16, (a0+b0)>>16].

FIG. 61 schematically shows a similar operation to that shown in FIG. 60but in this case, the instruction decoded is VRADH.I16.I32 Dd,Qn,Qm andthe operation performed is an add return high with rounding. This isperformed in a very similar way to the operation illustrated in FIG. 60but the high half is rounded. This is done, in this example, by adding adata value having a one in the most significant bit position of thelower half of the data value and zeros elsewhere after the addition andprior to taking the high half.

In this Figure as in FIG. 61 intermediate values are shown with dottedlines for clarity.

Further instructions (not illustrated) that may be supported are anaddition or subtraction return high with saturation. In this case theaddition or subtraction will be saturated where appropriate prior to thehigh half being taken.

Table 11 shows examples of some of the instructions that are supportedby the present technique. Size<a> returns the size of the data type inbits and round<td> returns rounding constant 1<<(size<dt>−1).

TABLE 11 Operand Mnemonic Data Type Format Description VADH .I8.I16 Dd,Qn, Qm Add returning High Half .I16.I32 Vd[ i ] := (Vn[ i ]+ .I32.I64Vm[ i ] )>>size<td> VRADH .I8.I16 Dd, Qn, Qm Add returning High .I16.I32Half with Rounding .I32.I64 Vd[ i ] := (Vn[ i ]+Vm[ i ]+round<td>) >>size<td> VSBH .I8.I16 Dd, Qn, Qm Subtract returning HighHalf .I16.I32 Vd [ i ] := (Vn [ i ] − .I32.I64 Vm[ i ] )>>size<td> VRSBH.I8.I16 Dd, Qn, Qm Subtract returning .I16.I32 High Half with Rounding.I32.I64 Vd [ i ] := (Vn [ i ] − Vm[ i ]+ round<td>) >>size<td>

The present technique can be performed on different types of dataprovided that taking the high half of the data is a sensible thing todo. It is particularly appropriate to processing performed on fixedpoint numbers.

The above technique has many applications and can be used, for example,to accelerate SIMD FFT implementations. SIMD is particularly useful forperforming FFT (fast fourier transform) operations, where the sameoperations need to be performed on multiple data. Thus, using SIMDprocessing allows the multiple data to be processed in parallel. Thecalculations performed for FFTs often involve multiplying complexnumbers together. This involves the multiplication of data values andthen the addition or subtraction of the products. In SIMD processingthese calculations are performed in parallel to increase processingspeed.

A simple example of the sort of sums that need to be performed is givenbelow.(a+ic)*(b+id)=e+if

Thus, the real portion e is equal to: a*b−c*d and

The imaginary portion f is equal to: a*d+c*b

FIG. 62 shows a calculation to determine the real portion e. As can beseen the vectors for a containing 16 bit data element are multipliedwith the vectors for b containing the same size data elements and thosefor c with d. These products produce two vectors with 32 bit dataelements. To produce e one of the vectors needs to be subtracted fromthe other but the final result is only needed to the same accuracy asthe original values. Thus, a resulting vector with 16 bit data elementsis required. This operation can be performed in response to the singleinstruction VSBH.16.32 Dd, Qn, Qm as is shown in the Figure. Thisinstruction, subtract return high half, is therefore particularly usefulin this context. Furthermore, it has the advantage of allowing thearithmetic operation to be performed on the wider data width and thenarrowing only occurring after the arithmetic operation (subtraction).This generally gives a more accurate result than narrowing prior toperforming the subtraction.

ARM have provided their instruction set with an instruction encodingwhich allows an immediate to be specified with some instructions.Clearly, the immediate size should be limited if it is encoded with theinstruction.

An immediate value of a size suitable for encoding with an instructionhas limited use in SIMD processing where data elements are processed inparallel. In order to address this problem, a set of instructions withgenerated constant is provided that have a limited size immediateassociated therewith, but have the ability to expand this immediate.Thus, for example, a byte sized immediate can be expanded to produce a64-bit constant or immediate. In this way the immediate can be used inlogical operations with a 64-bit source register comprising multiplesource data elements in SIMD processing.

FIG. 63 shows an immediate abcdefgh, that is encoded within aninstruction along with a control value, which is shown in the left handcolumn of the table. The binary immediate can be expanded to fill a64-bit register, the actual expansion performed depending on theinstruction and the control portion associated with it. In the exampleshown, the 8-bit immediate abcdefgh, is repeated at different placeswithin a 64 bit data value, the positions at which the immediate isplaced depending on the control value. Furthermore, zeros and/or onescan be used to fill the empty spaces where the value is not placed. Thechoice of either ones and/or zeros is also determined by the controlvalue. Thus, in this example a wide range of possible constants for usein SIMD processing can be produced from an instruction having an 8-bitimmediate and 4-bit control value associated with it.

In one embodiment (last line of the table), instead of repeating theimmediate at certain places, each bit of the immediate is expanded toproduce the new 64 bit immediate or constant.

As can be seen in some cases, the constant is the same in each lane,while in others different constants appear in some of the lanes. In someembodiments (not shown), the possibility of inverting these constants isalso provided and this also increases the number of constants that canbe generated.

An example of the format of an instruction that can be used for constantgeneration as shown in FIG. 63 is given below. In this instructions<value> is the data portion or immediate and <mode> is the controlportion which provides an indication as to how the <value> portion is tobe expanded within the generated constant (shown as different lines inthe table of FIG. 63).

-   VMOV Dd, #<value>, <mode>    where-   <value> is a byte-   <mode> is one of the enumerated expansion functions

These adapted instructions generally have an associated data value thathas a data portion <value> which comprises the immediate and a controlportion <mode>. As is shown in FIG. 63 the control portion indicates howthe immediate is to be expanded. This may be done in a variety of ways,but in some embodiments, the control portion indicates which expansionof the constant is to be performed using constant generation logic.

FIG. 64 schematically shows an example of constant generation logicoperable to generate a constant from a data portion 1210 and a controlportion 1200 associated with an instruction according to the presenttechnique. In the example shown, the control portion 1200 controls thecontrol generation logic 1220, which comprises gates 1230 to outputeither a portion of the data value 1210, or a one or a zero to each bitwithin the constant 1240 to be generated.

FIG. 65 shows a data processor (integrated circuit) similar to thatshown in FIG. 1, with like reference numerals representing likefeatures. FIG. 65 differs from FIG. 1 in that it explicitly showsconstant generation logic 1220. Constant generation logic 1220 can beconsidered to be adjacent to, or forming part, of the decode/controlportion 14, 16. As can be seen instructions are sent from theinstruction pipeline 12 to the decode/control logic 14, 16. Thisproduces control signals which control the operation of the SIMDprocessing logic 18, the load store unit 22, and the scalar processingportion 4, 6, 8, 10 of the processor. If an instruction with constantgeneration is received at the decode/control portion 14, 16, theconstant generation logic is used to generate a constant for use in SIMDprocessing. This can either be sent directly to the SIMD register datastore 20 (dotted line 1222), or if the instruction with constantgeneration comprises a SIMD data processing part, the generated constantis sent to the SIMD processing logic (line 1224) where furthermanipulations are performed on the generated constant to produce a newdata value.

FIGS. 66A and B schematically illustrates the two different paths shownin FIG. 65. FIG. 66A shows the case where the instruction generates aconstant which is sent directly to the register store, i.e. dotted line1222. FIG. 66B, shows the case where the instruction with generatedconstant comprises a data processing part. In this case data processingoperations (OP) are performed on the generated constant and a furthersource operand 1250 to produce a final data value 1260 in response tothe instruction, this corresponds to line 1224 of FIG. 65.

In addition to the constants shown in FIG. 63 and their inversions,additional data processing operations such as an OR, AND, test add orsubtract can be performed on the generated constants to generate a muchwider range of data values. This corresponds to FIG. 13B and path 1224in FIG. 65. Table 12 gives an example of bitwise AND and bitwise OR thatcan be used to generate some additional data values.

Mnemonic Data Type Operand Format Description VAND none Dd,#<value>,<mode> Bitwise AND with generated constant Vd := Vd &<generated constant> VORR none Dd, #<value>,<mode> Bitwise OR withgenerated constant Vd := Vd | <generated constant>

The ability to perform further data processing operations on thegenerated constants can have a variety of uses. For example, FIG. 67shows how embodiments of the present technique can be used to generate abit mask to extract a certain bit or bits from a number of data elementsin a vector. In the example shown the fourth bit of each data elementfrom a source vector is extracted. Initially the immediate 8 is expandedby repeating it and then this is followed by a logical AND instructionwhich ANDs the generated constant with a source vector to extract thedesired bit from each data element. These operations are performed inresponse to the instruction

VAND Dd,#0b00001000, 0b1100

Wherein the <mode> value 1100 refers to a generated constant comprisingan expanded data portion (see FIG. 63).

Although a particular embodiment has been described herein, it will beappreciated that the invention is not limited thereto and that manymodifications and additions thereto may be made within the scope of theinvention. For example, various combinations of the features of thefollowing dependent claims could be made with the features of theindependent claims without departing from the scope of the presentinvention.

1. A data processing apparatus, comprising: a register data store havinga plurality of registers operable to store data elements; a processoroperable to perform a data processing operation on one or more of saiddata elements accessed in at least one of said registers; access logicoperable in response to an access instruction to perform an accessoperation in order to move a number of said data elements betweenspecified registers of said plurality of registers and a portion of amemory, the portion having a start address specified by the accessinstruction; the access instruction having an alignment specifierassociated therewith which is settable either to a first value or one ofa plurality of second values, the first value indicating that the startaddress is to be treated as byte aligned, and each of the second valuesindicating a different predetermined alignment that the start address isto be treated as conforming to; and the access logic being operable toadapt the access operation in dependence on the value of the alignmentspecifier.
 2. A data processing apparatus as claimed in claim 1, whereinthe access logic is operable to adapt the access operation bydetermining a number of accesses to be allocated to perform the accessoperation in dependence on the value of the alignment specifier.
 3. Adata processing apparatus as claimed in claim 1, wherein the alignmentspecifier is provided within the access instruction.
 4. A dataprocessing apparatus as claimed in claim 1, further comprising a statusregister operable to store the alignment specifier.
 5. A data processingapparatus as claimed in claim 1, wherein said access instruction is aload instruction, said access logic being operable in response to saidload instruction to load the number of data elements from said portionof memory to said specified registers.
 6. A data processing apparatus asclaimed in claim 1, wherein said access instruction is a storeinstruction, said access logic being operable in response to said storeinstruction to store the number of data elements from said specifiedregisters to said portion of memory.
 7. A data processing apparatus asclaimed in claim 1, wherein the number of data elements comprises aplurality of data elements, and the number of data elements is derivablefrom the access instruction.
 8. A data processing apparatus as claimedin claim 1, wherein the processor is operable to perform in parallel adata processing operation on multiple data elements accessed in at leastone of said registers.
 9. A method of operating a data processingapparatus comprising a register data store having a plurality ofregisters operable to store data elements, and a processor operable toperform a data processing operation on one or more of said data elementsaccessed in at least one of said registers, the method comprising thesteps of: issuing an access instruction used to perform an accessoperation in order to move a number of said data elements betweenspecified registers or said plurality of registers and a portion of amemory, the portion having a start address specified by the accessinstruction; an alignment specifier being associated with the accessinstruction and being set either to a first value or one of a pluralityof second values, the first value indicating that the start address isto be treated as byte aligned, and each of the second values indicatinga different predetermined alignment that the start address is to betreated as conforming to, and the method further comprising the stepsof: adapting the access operation in dependence on the value of thealignment specifier; and performing the access operation.
 10. A methodas claimed in claim 9, wherein said adapting step comprises the step ofdetermining a number of accesses to be allocated to perform the accessoperation in dependence on the value of the alignment specifier.
 11. Amethod as claimed in claim 9, wherein the alignment specifier isprovided within the access instruction.
 12. A method as claimed in claim9, further comprising the step of storing the alignment specifier withina status register.
 13. A method as claimed in claim 9, wherein saidaccess instruction is a load instruction, said performing stepcomprising the step of, in response to said load instruction, loadingthe number of data elements from said portion of memory to saidspecified registers.
 14. A method as claimed in claim 9, wherein saidaccess instruction is a store instruction, said performing stepcomprising the step of, in response to said store instruction, storingthe number of data elements from said specified registers to saidportion of memory.
 15. A method as claimed in claim 9, wherein thenumber of data elements comprises a plurality of data elements, and thenumber of data elements is derivable from the access instruction.
 16. Amethod as claimed in claim 9, wherein the processor is operable toperform in parallel a data processing operation on multiple dataelements accessed in at least one of said registers.
 17. A computerprogram product comprising a computer program including at least oneaccess instruction which when executed causes a data processingapparatus to operate in accordance with the method of claim 9.